| Index: chrome/browser/extensions/user_script_master.cc
|
| diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
|
| index b0552e0fba49968356cda85da9efdeef9bbde52e..0219cf706724d92dc12819f942e391bd5ef6dc2c 100644
|
| --- a/chrome/browser/extensions/user_script_master.cc
|
| +++ b/chrome/browser/extensions/user_script_master.cc
|
| @@ -51,7 +51,11 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
|
|
|
| static const base::StringPiece kUserScriptBegin("// ==UserScript==");
|
| static const base::StringPiece kUserScriptEng("// ==/UserScript==");
|
| + static const base::StringPiece kNamespaceDeclaration("// @namespace ");
|
| + static const base::StringPiece kNameDeclaration("// @name ");
|
| + static const base::StringPiece kDescriptionDeclaration("// @description ");
|
| static const base::StringPiece kIncludeDeclaration("// @include ");
|
| + static const base::StringPiece kExcludeDeclaration("// @exclude ");
|
| static const base::StringPiece kMatchDeclaration("// @match ");
|
| static const base::StringPiece kRunAtDeclaration("// @run-at ");
|
| static const base::StringPiece kRunAtDocumentStartValue("document-start");
|
| @@ -79,6 +83,16 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
|
| ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\");
|
| ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?");
|
| script->add_glob(value);
|
| + } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) {
|
| + ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\");
|
| + ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?");
|
| + script->add_exclude_glob(value);
|
| + } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) {
|
| + script->set_name_space(value);
|
| + } else if (GetDeclarationValue(line, kNameDeclaration, &value)) {
|
| + script->set_name(value);
|
| + } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) {
|
| + script->set_description(value);
|
| } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) {
|
| URLPattern pattern;
|
| if (!pattern.Parse(value))
|
| @@ -97,10 +111,6 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
|
| line_start = line_end + 1;
|
| }
|
|
|
| - // It is probably a mistake to declare both @include and @match rules.
|
| - if (script->globs().size() > 0 && script->url_patterns().size() > 0)
|
| - return false;
|
| -
|
| // If no patterns were specified, default to @include *. This is what
|
| // Greasemonkey does.
|
| if (script->globs().size() == 0 && script->url_patterns().size() == 0)
|
|
|