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

Unified Diff: chrome/renderer/user_script_slave.cc

Issue 412008: Introduce a new 'all_frames' property to content scripts and (Closed)
Patch Set: responses to comments 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/renderer/user_script_slave.cc
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index bdddbc31f1353ced8683ba482209f1539a21602f..bfd08c543ede57725da77660278fe8ce748acff7 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -141,6 +141,10 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
for (size_t i = 0; i < scripts_.size(); ++i) {
std::vector<WebScriptSource> sources;
UserScript* script = scripts_[i];
+
+ if (frame->parent() && !script->match_all_frames())
+ continue; // Only match subframes if the script declared it wanted to.
+
if (!script->MatchesUrl(frame->url()))
continue; // This frame doesn't match the script url pattern, skip it.
« no previous file with comments | « chrome/common/extensions/user_script.cc ('k') | chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698