Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 272613002: DevTools: implemented scriptFailedToParse protocol event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorDebuggerAgent.cpp
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index 5c8cc5978be6ee22aae0e5dd15ac468d8247aef6..03a3f10dd6a0f009d3b931e7e110e25861317518 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -1157,9 +1157,48 @@ void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
}
}
-void InspectorDebuggerAgent::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
+void InspectorDebuggerAgent::failedToParseSource(const String& scriptId, const Script& script)
{
- m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessage);
+ const bool* isContentScript = script.isContentScript ? &script.isContentScript : 0;
+ String sourceMapURL = sourceMapURLForScript(script);
+ String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL;
+ String sourceURL;
+ if (!script.startLine && !script.startColumn) {
+ bool deprecated;
+ sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
+ // FIXME: add deprecated console message here.
+ }
+ bool hasSourceURL = !sourceURL.isEmpty();
+ String scriptURL = hasSourceURL ? sourceURL : script.url;
+ bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0;
+ m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, hasSourceURLParam);
+
+ m_scripts.set(scriptId, script);
+
+ if (scriptURL.isEmpty())
+ return;
+
+ RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints);
vsevik 2014/06/27 12:35:14 We don't care about breakpoints for scripts that h
+ for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpointsCookie->end(); ++it) {
+ RefPtr<JSONObject> breakpointObject = it->value->asObject();
+ bool isAntibreakpoint;
+ breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoint);
+ if (isAntibreakpoint)
+ continue;
+ bool isRegex;
+ breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
+ String url;
+ breakpointObject->getString(DebuggerAgentState::url, &url);
+ if (!matches(scriptURL, url, isRegex))
+ continue;
+ ScriptBreakpoint breakpoint;
+ breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.lineNumber);
+ breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoint.columnNumber);
+ breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.condition);
+ RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->key, scriptId, breakpoint, UserBreakpointSource);
+ if (location)
+ m_frontend->breakpointResolved(it->key, location);
+ }
}
void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints)

Powered by Google App Engine
This is Rietveld 408576698