Chromium Code Reviews| Index: Source/core/inspector/InspectorDebuggerAgent.cpp |
| diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp |
| index aed3388e4dc8ff7bdebe4653d3b0901148d08892..394fc2edcd5eb24a0fd0c5a74fbbb1525d0e9efe 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,29 @@ 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, Script& script, CompileResult compileResult) |
| { |
| - // Don't send script content to the front end until it's really needed. |
| 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(); |
|
yurys
2014/07/17 14:05:40
I don't like that we modify Script here. Let's mov
|
| } |
| - 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 |