diff options
Diffstat (limited to 'chrome/common/extensions/extension.cc')
-rw-r--r-- | chrome/common/extensions/extension.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 1a665d4..f09fba8 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -247,11 +247,21 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, IntToString(definition_index), IntToString(j)); return false; } + std::string scheme = pattern.scheme(); + if (scheme == "file") { + // No content scripts are allowed unless the command line override switch + // was provided. + if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableJsOnFileUrls)) { + *error = errors::kInvalidJsMatches; + return false; + } + } result->add_url_pattern(pattern); } - // include/exclude globs (mostly for Greasemonkey compat) + // Include/exclude globs (mostly for Greasemonkey compatibility). if (!LoadGlobsHelper(content_script, definition_index, keys::kIncludeGlobs, error, &UserScript::add_glob, result)) { return false; @@ -262,7 +272,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, return false; } - // js and css keys + // js and css keys. ListValue* js = NULL; if (content_script->HasKey(keys::kJs) && !content_script->GetList(keys::kJs, &js)) { |