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)); |
} |