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

Unified Diff: Source/core/inspector/ContentSearchUtils.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/ContentSearchUtils.h ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/ContentSearchUtils.cpp
diff --git a/Source/core/inspector/ContentSearchUtils.cpp b/Source/core/inspector/ContentSearchUtils.cpp
index 18877fe4306b2c88c074a34793e8cb733a670223..64dc15247829ef201519fc1aa38eb8716ca3d4b5 100644
--- a/Source/core/inspector/ContentSearchUtils.cpp
+++ b/Source/core/inspector/ContentSearchUtils.cpp
@@ -162,25 +162,36 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > searchInTextByLi
return result;
}
-String findMagicComment(const String& content, const String& name, MagicCommentType commentType)
+static String findMagicComment(const String& content, const String& name, MagicCommentType commentType, bool* deprecated = 0)
{
ASSERT(name.find("=") == notFound);
+ if (deprecated)
+ *deprecated = false;
String pattern;
+ String deprecatedPattern;
switch (commentType) {
case JavaScriptMagicComment:
- pattern= "//@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s\'\"]*)[\040\t]*$";
+ pattern = "//#[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s\'\"]*)[\040\t]*$";
+ deprecatedPattern = "//@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s\'\"]*)[\040\t]*$";
break;
case CSSMagicComment:
- pattern= "/\\*@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s]*)[\040\t]*\\*/[\040\t]*$";
+ pattern = "/\\*#[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s]*)[\040\t]*\\*/[\040\t]*$";
+ deprecatedPattern = "/\\*@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s]*)[\040\t]*\\*/[\040\t]*$";
break;
default:
ASSERT_NOT_REACHED();
return String();
}
RegularExpression regex(pattern, TextCaseSensitive, MultilineEnabled);
+ RegularExpression deprecatedRegex(deprecatedPattern, TextCaseSensitive, MultilineEnabled);
int matchLength;
int offset = regex.match(content, 0, &matchLength);
+ if (offset == -1) {
+ offset = deprecatedRegex.match(content, 0, &matchLength);
+ if (offset != -1 && deprecated)
+ *deprecated = true;
+ }
if (offset == -1)
return String();
@@ -203,14 +214,14 @@ String findMagicComment(const String& content, const String& name, MagicCommentT
}
}
-String findSourceURL(const String& content, MagicCommentType commentType)
+String findSourceURL(const String& content, MagicCommentType commentType, bool* deprecated)
{
- return findMagicComment(content, "sourceURL", commentType);
+ return findMagicComment(content, "sourceURL", commentType, deprecated);
}
-String findSourceMapURL(const String& content, MagicCommentType commentType)
+String findSourceMapURL(const String& content, MagicCommentType commentType, bool* deprecated)
{
- return findMagicComment(content, "sourceMappingURL", commentType);
+ return findMagicComment(content, "sourceMappingURL", commentType, deprecated);
}
} // namespace ContentSearchUtils
« no previous file with comments | « Source/core/inspector/ContentSearchUtils.h ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698