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

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

Issue 15832007: DevTools: Add support for //# sourceURL (sourceMappingURL) comments and deprecate //@ ones (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 7 years, 6 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/InspectorPageAgent.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 859792845db396bc521e1c5574bee95e332adfdc..f2faaa4a8ca4a6e6906e041a40b877902f6894fa 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -635,11 +635,13 @@ PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::cur
String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
{
- DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, (ASCIILiteral("X-SourceMap")));
-
- String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, ContentSearchUtils::JavaScriptMagicComment);
- if (!sourceMapURL.isEmpty())
+ bool deprecated;
+ String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
+ if (!sourceMapURL.isEmpty()) {
+ if (deprecated)
+ addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@ sourceMapURL=\" source mapping URL declaration is deprecated, \"//# sourceMapURL=\" declaration should be used instead.", script.url);
return sourceMapURL;
+ }
if (script.url.isEmpty())
return String();
@@ -647,11 +649,7 @@ String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent();
if (!pageAgent)
return String();
-
- CachedResource* resource = pageAgent->cachedResource(pageAgent->mainFrame(), KURL(ParsedURLString, script.url));
- if (resource)
- return resource->response().httpHeaderField(sourceMapHttpHeader);
- return String();
+ return pageAgent->resourceSourceMapURL(script.url);
}
// JavaScriptDebugListener functions
@@ -663,8 +661,12 @@ void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
String sourceMapURL = sourceMapURLForScript(script);
String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL;
String sourceURL;
- if (!script.startLine && !script.startColumn)
- sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSearchUtils::JavaScriptMagicComment);
+ if (!script.startLine && !script.startColumn) {
+ bool deprecated;
+ sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSearchUtils::JavaScriptMagicComment, &deprecated);
+ if (deprecated)
+ addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@ sourceURL=\" source URL declaration is deprecated, \"//# sourceURL=\" declaration should be used instead.", script.url);
+ }
bool hasSourceURL = !sourceURL.isEmpty();
String scriptURL = hasSourceURL ? sourceURL : script.url;
bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0;
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/InspectorPageAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698