Chromium Code Reviews| Index: Source/core/inspector/InspectorStyleSheet.cpp |
| diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp |
| index 1d86681f4b08d804c0710d5867827eb3276818ec..22329b4c69adc2a2c15bc0667346f4596186f7e7 100644 |
| --- a/Source/core/inspector/InspectorStyleSheet.cpp |
| +++ b/Source/core/inspector/InspectorStyleSheet.cpp |
| @@ -55,6 +55,7 @@ |
| #include "core/inspector/InspectorPageAgent.h" |
| #include "core/inspector/InspectorValues.h" |
| #include "core/page/ContentSecurityPolicy.h" |
| +#include "core/page/PageConsole.h" |
| #include "core/platform/text/RegularExpression.h" |
| #include <wtf/OwnPtr.h> |
| @@ -1485,10 +1486,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); |
|
apavlov
2013/05/29 13:58:05
We need a kind of utility for this :(
|
| m_sourceURL = commentValue; |
| - return m_sourceURL; |
| + return commentValue; |
| } |
| } |
| m_sourceURL = ""; |
| @@ -1530,26 +1534,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 |