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

Unified Diff: extensions/renderer/script_injection.cc

Issue 2116613002: Prevent duplicate content script injection defined in manifest.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed code review on patch 8 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/script_injection.h ('k') | extensions/renderer/script_injector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_injection.cc
diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc
index da93590c3908c00fb33421a2b3ff9f1077e04b06..2489788369e0c44577187a140624c62358907b7a 100644
--- a/extensions/renderer/script_injection.cc
+++ b/extensions/renderer/script_injection.cc
@@ -219,9 +219,9 @@ ScriptInjection::InjectionResult ScriptInjection::Inject(
DCHECK(should_inject_js || should_inject_css);
if (should_inject_js)
- InjectJs();
+ InjectJs(scripts_run_info);
if (should_inject_css)
- InjectCss();
+ InjectCss(scripts_run_info);
complete_ = did_inject_js_ || !should_inject_js;
@@ -237,11 +237,11 @@ ScriptInjection::InjectionResult ScriptInjection::Inject(
return complete_ ? INJECTION_FINISHED : INJECTION_BLOCKED;
}
-void ScriptInjection::InjectJs() {
+void ScriptInjection::InjectJs(ScriptsRunInfo* scripts_run_info) {
DCHECK(!did_inject_js_);
blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame();
std::vector<blink::WebScriptSource> sources =
- injector_->GetJsSources(run_location_);
+ injector_->GetJsSources(run_location_, scripts_run_info);
bool in_main_world = injector_->ShouldExecuteInMainWorld();
int world_id = in_main_world
? DOMActivityLogger::kMainWorldId
@@ -311,9 +311,9 @@ void ScriptInjection::OnJsInjectionCompleted(
}
}
-void ScriptInjection::InjectCss() {
+void ScriptInjection::InjectCss(ScriptsRunInfo* scripts_run_info) {
std::vector<std::string> css_sources =
- injector_->GetCssSources(run_location_);
+ injector_->GetCssSources(run_location_, scripts_run_info);
blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame();
for (const std::string& css : css_sources)
web_frame->document().insertStyleSheet(blink::WebString::fromUTF8(css));
« no previous file with comments | « extensions/renderer/script_injection.h ('k') | extensions/renderer/script_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698