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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp

Issue 1615523002: Transitively keep track of an isolated world's children scripts and worlds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a static world stack instead of a per-world private field Created 4 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
Index: third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp b/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp
index a6c7caf66d208e3b4b93eb65f7adf0353b770e29..9671b2e6bb6860c7930bcb3b4051f18c80df0590 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp
@@ -46,6 +46,7 @@ V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, DOMWrapperWor
: EventListener(JSEventListenerType)
, m_isAttribute(isAttribute)
, m_world(world)
+ , m_originWorld(PassRefPtr<DOMWrapperWorld>(world.originWorld()))
, m_isolate(isolate)
, m_workerGlobalScope(nullptr)
{
@@ -91,11 +92,14 @@ void V8AbstractEventListener::handleEvent(ScriptState* scriptState, Event* event
RefPtrWillBeRawPtr<V8AbstractEventListener> protect(this);
ScriptState::Scope scope(scriptState);
+ // Ensure the origin world gets propagated to the event and is reset afterwards.
+ DOMWrapperWorld::OriginWorldScope worldScope(m_originWorld);
// Get the V8 wrapper for the event object.
v8::Local<v8::Value> jsEvent = toV8(event, scriptState->context()->Global(), isolate());
if (jsEvent.IsEmpty())
return;
+
invokeEventHandler(scriptState, event, v8::Local<v8::Value>::New(isolate(), jsEvent));
}

Powered by Google App Engine
This is Rietveld 408576698