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

Unified Diff: extensions/renderer/user_script_injector.cc

Issue 2206463002: Revert of Prevent duplicate content script injection defined in manifest.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/user_script_injector.cc
diff --git a/extensions/renderer/user_script_injector.cc b/extensions/renderer/user_script_injector.cc
index f653cf4b792327763d2609181802f725bad47bcb..1910548ba24b340d720cd7eb4ea16d8af38e6416 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -197,8 +197,7 @@
}
std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources(
- UserScript::RunLocation run_location,
- ScriptsRunInfo* scripts_run_info) const {
+ UserScript::RunLocation run_location) const {
std::vector<blink::WebScriptSource> sources;
if (!script_)
return sources;
@@ -210,11 +209,6 @@
for (UserScript::FileList::const_iterator iter = js_scripts.begin();
iter != js_scripts.end();
++iter) {
- const GURL& script_url = iter->url();
- // Check if the script is already injected.
- if (scripts_run_info->injected_scripts.count(script_url) != 0)
- continue;
-
std::string content = iter->GetContent().as_string();
// We add this dumb function wrapper for user scripts to emulate what
@@ -224,9 +218,7 @@
content += kUserScriptTail;
}
sources.push_back(blink::WebScriptSource(
- blink::WebString::fromUTF8(content), script_url));
-
- scripts_run_info->injected_scripts.insert(script_url);
+ blink::WebString::fromUTF8(content), iter->url()));
}
// Emulate Greasemonkey API for scripts that were converted to extension
@@ -238,8 +230,7 @@
}
std::vector<std::string> UserScriptInjector::GetCssSources(
- UserScript::RunLocation run_location,
- ScriptsRunInfo* scripts_run_info) const {
+ UserScript::RunLocation run_location) const {
DCHECK_EQ(UserScript::DOCUMENT_START, run_location);
std::vector<std::string> sources;
@@ -247,18 +238,10 @@
return sources;
const UserScript::FileList& css_scripts = script_->css_scripts();
-
for (UserScript::FileList::const_iterator iter = css_scripts.begin();
iter != css_scripts.end();
++iter) {
- const GURL& script_url = iter->url();
- // Check if the stylesheet is already injected.
- if (scripts_run_info->injected_scripts.find(script_url) ==
- scripts_run_info->injected_scripts.end()) {
- sources.push_back(iter->GetContent().as_string());
-
- scripts_run_info->injected_scripts.insert(script_url);
- }
+ sources.push_back(iter->GetContent().as_string());
}
return sources;
}
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698