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

Unified Diff: extensions/renderer/script_context_set.cc

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: Fix GCCallbackTest Created 3 years, 11 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_context_set.h ('k') | extensions/renderer/script_context_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_context_set.cc
diff --git a/extensions/renderer/script_context_set.cc b/extensions/renderer/script_context_set.cc
index 8f60dc9d598cea4713a40828deb3f09dc88f4404..0f813a056645f4dbe01c027a0d5ac08dc011ac73 100644
--- a/extensions/renderer/script_context_set.cc
+++ b/extensions/renderer/script_context_set.cc
@@ -10,7 +10,7 @@
#include "content/public/common/url_constants.h"
#include "content/public/renderer/render_frame.h"
#include "extensions/common/extension.h"
-#include "extensions/renderer/extension_groups.h"
+#include "extensions/renderer/extensions_renderer_client.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/script_injection.h"
#include "third_party/WebKit/public/web/WebDocument.h"
@@ -37,7 +37,6 @@ ScriptContextSet::~ScriptContextSet() {
ScriptContext* ScriptContextSet::Register(
blink::WebLocalFrame* frame,
const v8::Local<v8::Context>& v8_context,
- int extension_group,
int world_id) {
const Extension* extension =
GetExtensionFromFrameAndWorld(frame, world_id, false);
@@ -45,11 +44,10 @@ ScriptContext* ScriptContextSet::Register(
GetExtensionFromFrameAndWorld(frame, world_id, true);
GURL frame_url = ScriptContext::GetDataSourceURLForFrame(frame);
- Feature::Context context_type =
- ClassifyJavaScriptContext(extension, extension_group, frame_url,
- frame->document().getSecurityOrigin());
+ Feature::Context context_type = ClassifyJavaScriptContext(
+ extension, world_id, frame_url, frame->document().getSecurityOrigin());
Feature::Context effective_context_type = ClassifyJavaScriptContext(
- effective_extension, extension_group,
+ effective_extension, world_id,
ScriptContext::GetEffectiveDocumentURL(frame, frame_url, true),
frame->document().getSecurityOrigin());
@@ -171,14 +169,17 @@ const Extension* ScriptContextSet::GetExtensionFromFrameAndWorld(
Feature::Context ScriptContextSet::ClassifyJavaScriptContext(
const Extension* extension,
- int extension_group,
+ int world_id,
const GURL& url,
const blink::WebSecurityOrigin& origin) {
// WARNING: This logic must match ProcessMap::GetContextType, as much as
// possible.
- DCHECK_GE(extension_group, 0);
- if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS) {
+ // Worlds not within this range are not for content scripts, so ignore them.
+ // TODO(devlin): Isolated worlds with a non-zero id could belong to
+ // chrome-internal pieces, like dom distiller and translate. Do we need any
+ // bindings (even those for basic web pages) for those?
+ if (world_id >= ExtensionsRendererClient::Get()->GetLowestIsolatedWorldId()) {
return extension ? // TODO(kalman): when does this happen?
Feature::CONTENT_SCRIPT_CONTEXT
: Feature::UNSPECIFIED_CONTEXT;
« no previous file with comments | « extensions/renderer/script_context_set.h ('k') | extensions/renderer/script_context_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698