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

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

Issue 2420223002: Dispatching errors across iframes don't match webplatform tests
Patch Set: Added nested errors test and scope class." 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/V8Initializer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index 511642a838a24ce41f442df29f764fa13a5f3f69..adc9e33a013cc5086c82f1d4ed3e32e0230e9664 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -145,9 +145,18 @@ static void messageHandlerInMainThread(v8::Local<v8::Message> message,
else if (message->IsSharedCrossOrigin())
accessControlStatus = SharableCrossOrigin;
+ ScriptState* errorEventScriptState = context->errorEventScriptState();
haraken 2016/10/27 14:56:27 Why do you need to associate the ScriptStateForErr
+ if (!errorEventScriptState)
+ errorEventScriptState = scriptState;
+
+ if (!errorEventScriptState->contextIsValid())
+ return;
+
+ ExecutionContext* errorEventContext =
+ errorEventScriptState->getExecutionContext();
ErrorEvent* event =
ErrorEvent::create(toCoreStringWithNullCheck(message->Get()),
- std::move(location), &scriptState->world());
+ std::move(location), &errorEventScriptState->world());
String messageForConsole = extractMessageForConsole(isolate, data);
if (!messageForConsole.isEmpty())
@@ -158,15 +167,17 @@ static void messageHandlerInMainThread(v8::Local<v8::Message> message,
// during context creation.
// FIXME: Can we even get here during initialization now that we bail out when
// GetEntered returns an empty handle?
- if (context->isDocument()) {
- LocalFrame* frame = toDocument(context)->frame();
- if (frame && frame->script().existingWindowProxy(scriptState->world())) {
+ if (errorEventContext->isDocument()) {
+ LocalFrame* frame = toDocument(errorEventContext)->frame();
+ if (frame &&
+ frame->script().existingWindowProxy(errorEventScriptState->world())) {
V8ErrorHandler::storeExceptionOnErrorEventWrapper(
- scriptState, event, data, scriptState->context()->Global());
+ errorEventScriptState, event, data,
+ errorEventScriptState->context()->Global());
}
}
- if (scriptState->world().isPrivateScriptIsolatedWorld()) {
+ if (errorEventScriptState->world().isPrivateScriptIsolatedWorld()) {
// We allow a private script to dispatch error events even in a
// EventDispatchForbiddenScope scope. Without having this ability, it's
// hard to debug the private script because syntax errors in the private
@@ -175,9 +186,9 @@ static void messageHandlerInMainThread(v8::Local<v8::Message> message,
// error events don't propagate to other isolated worlds (which means that
// the error events won't fire any event listeners in user's scripts).
EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
- context->dispatchErrorEvent(event, accessControlStatus);
+ errorEventContext->dispatchErrorEvent(event, accessControlStatus);
} else {
- context->dispatchErrorEvent(event, accessControlStatus);
+ errorEventContext->dispatchErrorEvent(event, accessControlStatus);
}
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp ('k') | third_party/WebKit/Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698