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); |
+ return deprecatedHeaderSourceMapURL; |
+ } |
+ return resource->response().httpHeaderField(sourceMapHttpHeader); |
+} |
+ |
// static |
DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorString, Frame* frame) |
{ |