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

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

Issue 2420223002: Dispatching errors across iframes don't match webplatform tests
Patch Set: Created 4 years, 2 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/V8EventListener.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp b/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
index fa788f05a87ee8719f83a883275ee539675bb84e..100c161c3e1bd9c574d738d5b4c35b324b64e70f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
@@ -102,11 +102,19 @@ v8::Local<v8::Value> V8EventListener::callListenerFunction(
v8::Local<v8::Value> parameters[1] = {jsEvent};
v8::Local<v8::Value> result;
+ ScriptState* scriptStateForFunction = ScriptState::from(handlerFunction->CreationContext());
+ if (scriptStateForFunction->getExecutionContext() != scriptState->getExecutionContext())
+ scriptState->getExecutionContext()->setErrorEventScriptState(scriptStateForFunction);
dominicc (has gone to gerrit) 2016/10/16 08:45:57 I think you should write a stack allocated object
Anton Obzhirov 2016/10/17 09:49:34 Yes, I was thinking about setting context as well.
+
if (!V8ScriptRunner::callFunction(handlerFunction, frame->document(),
receiver, WTF_ARRAY_LENGTH(parameters),
parameters, scriptState->isolate())
- .ToLocal(&result))
+ .ToLocal(&result)) {
+ scriptState->getExecutionContext()->clearErrorEventScriptState();
return v8::Local<v8::Value>();
+ }
+
+ scriptState->getExecutionContext()->clearErrorEventScriptState();
return result;
}

Powered by Google App Engine
This is Rietveld 408576698