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

Unified Diff: extensions/renderer/extension_frame_helper.cc

Issue 2740873005: ExtensionFrameHelper shouldn't trigger initialization of the main world (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/extension_frame_helper.cc
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc
index 71141452905812b731276395c7cbd239c9eac264..28245a67354b36fcf2ea955259a8ef002bc6e8ba 100644
--- a/extensions/renderer/extension_frame_helper.cc
+++ b/extensions/renderer/extension_frame_helper.cc
@@ -27,6 +27,8 @@ namespace extensions {
namespace {
+constexpr int kMainWorldId = 0;
Yuki 2017/03/10 07:34:46 side note: Probably, we should get rid of exposing
haraken 2017/03/10 09:17:26 Yeah, agreed. Ideally I want to entirely remove wo
+
base::LazyInstance<std::set<const ExtensionFrameHelper*>>::DestructorAtExit
g_frame_helpers = LAZY_INSTANCE_INITIALIZER;
@@ -198,16 +200,15 @@ void ExtensionFrameHelper::DidStartProvisionalLoad(
render_frame()->GetWebFrame()->mainWorldScriptContext();
v8::Context::Scope context_scope(context);
extension_dispatcher_->DidCreateScriptContext(render_frame()->GetWebFrame(),
- context, 0);
+ context, kMainWorldId);
// TODO(devlin): Add constants for main world id, no extension group.
}
void ExtensionFrameHelper::DidCreateScriptContext(
v8::Local<v8::Context> context,
int world_id) {
- if (context == render_frame()->GetWebFrame()->mainWorldScriptContext() &&
+ if (world_id == kMainWorldId &&
render_frame()->IsBrowserSideNavigationPending()) {
- DCHECK_EQ(0, world_id);
DCHECK(!delayed_main_world_script_initialization_);
// Defer initializing the extensions script context now because it depends
// on having the URL of the provisional load which isn't available at this
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698