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

Unified Diff: chrome/common/extensions/extension.cc

Issue 402029: Don't allow content scripts to execute on file:// urls.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
Index: chrome/common/extensions/extension.cc
===================================================================
--- chrome/common/extensions/extension.cc (revision 32232)
+++ chrome/common/extensions/extension.cc (working copy)
@@ -247,11 +247,21 @@
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 @@
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)) {
« no previous file with comments | « chrome/common/extensions/docs/static/content_scripts.html ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698