diff options
Diffstat (limited to 'src/core/user_script.cpp')
-rw-r--r-- | src/core/user_script.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index b33dd6a7d..9b9d66d55 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -244,13 +244,20 @@ void UserScript::parseMetadataHeader() if (GetDeclarationValue(line, kNameDeclaration, &value)) { setName(toQt(value)); } else if (GetDeclarationValue(line, kIncludeDeclaration, &value)) { - // We escape some characters that MatchPattern() considers special. - base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); - base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + if (value.front() != '/' || value.back() != '/') { + // The greasemonkey spec only allows for wildcards (*), so + // escape the additional things which MatchPattern allows. + base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); + base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + } scriptData->globs.push_back(value); } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { - base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); - base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + if (value.front() != '/' || value.back() != '/') { + // The greasemonkey spec only allows for wildcards (*), so + // escape the additional things which MatchPattern allows. + base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); + base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + } scriptData->excludeGlobs.push_back(value); } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { if (URLPattern::PARSE_SUCCESS == urlPatternParser.Parse(value)) |