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

Unified Diff: Source/core/inspector/InspectorStyleSheet.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/InspectorPageAgent.cpp ('k') | Source/core/inspector/PageDebuggerAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorStyleSheet.cpp
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index bb1a8596f1049fc909decbc3d0494841efa247cf..9b8a4e38fabb10e3480a7a2c41fd0cae38fdac2b 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -50,6 +50,8 @@
#include "core/inspector/InspectorCSSAgent.h"
#include "core/inspector/InspectorPageAgent.h"
#include "core/inspector/InspectorValues.h"
+#include "core/page/Page.h"
+#include "core/page/PageConsole.h"
#include "core/platform/text/RegularExpression.h"
#include <wtf/OwnPtr.h>
@@ -1478,10 +1480,13 @@ String InspectorStyleSheet::sourceURL() const
String styleSheetText;
bool success = getText(&styleSheetText);
if (success) {
- String commentValue = ContentSearchUtils::findSourceURL(styleSheetText, ContentSearchUtils::CSSMagicComment);
+ bool deprecated;
+ String commentValue = ContentSearchUtils::findSourceURL(styleSheetText, ContentSearchUtils::CSSMagicComment, &deprecated);
if (!commentValue.isEmpty()) {
+ if (deprecated)
+ m_pageAgent->page()->console()->addMessage(NetworkMessageSource, WarningMessageLevel, "\"/*@ sourceURL=\" source URL declaration is deprecated, \"/*# sourceURL=\" declaration should be used instead.", finalURL(), 0);
m_sourceURL = commentValue;
- return m_sourceURL;
+ return commentValue;
}
}
m_sourceURL = "";
@@ -1523,26 +1528,21 @@ bool InspectorStyleSheet::startsAtZero() const
String InspectorStyleSheet::sourceMapURL() const
{
- DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, (ASCIILiteral("X-SourceMap")));
-
if (m_origin != TypeBuilder::CSS::StyleSheetOrigin::Regular)
return String();
String styleSheetText;
bool success = getText(&styleSheetText);
if (success) {
- String commentValue = ContentSearchUtils::findSourceMapURL(styleSheetText, ContentSearchUtils::CSSMagicComment);
- if (!commentValue.isEmpty())
+ bool deprecated;
+ String commentValue = ContentSearchUtils::findSourceMapURL(styleSheetText, ContentSearchUtils::CSSMagicComment, &deprecated);
+ if (!commentValue.isEmpty()) {
+ if (deprecated)
+ m_pageAgent->page()->console()->addMessage(NetworkMessageSource, WarningMessageLevel, "\"/*@ sourceMapURL=\" source mapping URL declaration is deprecated, \"/*# sourceMapURL=\" declaration should be used instead.", finalURL(), 0);
return commentValue;
+ }
}
-
- if (finalURL().isEmpty())
- return String();
-
- CachedResource* resource = m_pageAgent->cachedResource(m_pageAgent->mainFrame(), KURL(ParsedURLString, finalURL()));
- if (resource)
- return resource->response().httpHeaderField(sourceMapHttpHeader);
- return String();
+ return m_pageAgent->resourceSourceMapURL(finalURL());
}
InspectorCSSId InspectorStyleSheet::ruleOrStyleId(CSSStyleDeclaration* style) const
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/inspector/PageDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698