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

Unified Diff: extensions/renderer/script_context_set.cc

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: 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..06710fd9f6bc5b28d2d8b9e646b563c95ece25cc 100644
--- a/extensions/renderer/script_context_set.cc
+++ b/extensions/renderer/script_context_set.cc
@@ -10,7 +10,6 @@
#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/script_context.h"
#include "extensions/renderer/script_injection.h"
#include "third_party/WebKit/public/web/WebDocument.h"
@@ -37,7 +36,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 +43,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 +168,15 @@ 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) {
+ // The main world ID is 0. Non-zero world IDs should indicate worlds created
+ // for content script.
dcheng 2017/01/12 01:39:52 This is the only real functional change in this CL
Devlin 2017/01/12 16:30:12 This isn't quite correct - instead, it should be:
dcheng 2017/01/12 18:35:12 Looking at this, I'm not actually sure what the ri
Devlin 2017/01/12 21:31:39 So, a couple of things here. Unspecified contexts
dcheng 2017/01/12 21:40:41 It could, but I'm not sure the burden of fixing th
Devlin 2017/01/12 22:02:09 There is a behavior change from the current behavi
+ if (world_id != 0) {
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