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

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

Issue 323523004: DevTools: Add scripts sourceURL plumbing from v8. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed Created 6 years, 5 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
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/ScriptDebugListener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDebuggerAgent.cpp
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index aed3388e4dc8ff7bdebe4653d3b0901148d08892..1f52a8c241f5b807e0fe31553fd7153d65f92cb2 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -1175,15 +1175,19 @@ PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn
return result.release();
}
-String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
+String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script, CompileResult compileResult)
{
- bool deprecated;
- String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
- if (!sourceMapURL.isEmpty()) {
- // FIXME: add deprecated console message here.
- return sourceMapURL;
+ bool hasSyntaxError = compileResult != CompileSuccess;
+ if (hasSyntaxError) {
+ bool deprecated;
+ String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
+ if (!sourceMapURL.isEmpty())
+ return sourceMapURL;
}
+ if (!script.sourceMappingURL.isEmpty())
+ return script.sourceMappingURL;
+
if (script.url.isEmpty())
return String();
@@ -1193,24 +1197,30 @@ String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
return pageAgent->resourceSourceMapURL(script.url);
}
-// JavaScriptDebugListener functions
+// ScriptDebugListener functions
-void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script& script, CompileResult compileResult)
+void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script& parsedScript, CompileResult compileResult)
{
- // Don't send script content to the front end until it's really needed.
+ Script script = parsedScript;
const bool* isContentScript = script.isContentScript ? &script.isContentScript : 0;
- String sourceMapURL = sourceMapURLForScript(script);
- String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL;
- String sourceURL;
+
+ bool hasSyntaxError = compileResult != CompileSuccess;
if (!script.startLine && !script.startColumn) {
- bool deprecated;
- sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
- // FIXME: add deprecated console message here.
+ if (hasSyntaxError) {
+ bool deprecated;
+ script.sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
+ }
+ } else {
+ script.sourceURL = String();
}
- bool hasSourceURL = !sourceURL.isEmpty();
- String scriptURL = hasSourceURL ? sourceURL : script.url;
+
+ bool hasSourceURL = !script.sourceURL.isEmpty();
+ String scriptURL = hasSourceURL ? script.sourceURL : script.url;
+
+ String sourceMapURL = sourceMapURLForScript(script, compileResult);
+ String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL;
+
bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0;
- bool hasSyntaxError = compileResult != CompileSuccess;
if (!hasSyntaxError)
m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, hasSourceURLParam);
else
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/ScriptDebugListener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698