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

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

Issue 15832007: DevTools: Add support for //# sourceURL (sourceMappingURL) comments and deprecate //@ ones (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/InspectorPageAgent.cpp
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 0eb6ed54c2f794892c210982ad86afe4803efaa8..a0631677532ce8b0efa43a7e6b890ada3d797d10 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -66,6 +66,7 @@
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
+#include "core/page/PageConsole.h"
#include "core/page/Settings.h"
#include "core/platform/Cookie.h"
#include "core/platform/text/RegularExpression.h"
@@ -910,6 +911,26 @@ Frame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& f
return frame;
}
+String InspectorPageAgent::resourceSourceMapURL(const String& url)
+{
+ DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, (ASCIILiteral("SourceMap")));
+ DEFINE_STATIC_LOCAL(String, deprecatedSourceMapHttpHeader, (ASCIILiteral("X-SourceMap")));
+ if (url.isEmpty())
+ return String();
+ Frame* frame = mainFrame();
+ if (!frame)
+ return String();
+ CachedResource* resource = cachedResource(frame, KURL(ParsedURLString, url));
+ if (!resource)
+ return String();
+ String deprecatedHeaderSourceMapURL = resource->response().httpHeaderField(deprecatedSourceMapHttpHeader);
+ if (!deprecatedHeaderSourceMapURL.isEmpty()) {
+ m_page->console()->addMessage(NetworkMessageSource, WarningMessageLevel, "Resource is served with deprecated header X-SourceMap, SourceMap should be used instead.", url, 0);
apavlov 2013/05/29 13:58:05 Perhaps a note about phasing out the deprecated he
+ return deprecatedHeaderSourceMapURL;
+ }
+ return resource->response().httpHeaderField(sourceMapHttpHeader);
+}
+
// static
DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorString, Frame* frame)
{

Powered by Google App Engine
This is Rietveld 408576698