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

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

Issue 1095943002: DevTools: [console] Logged promise rejections do not change state once handled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: for landing Created 5 years, 8 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 | « Source/bindings/core/v8/RejectedPromises.cpp ('k') | Source/core/frame/ConsoleTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8Initializer.cpp
diff --git a/Source/bindings/core/v8/V8Initializer.cpp b/Source/bindings/core/v8/V8Initializer.cpp
index 9c20ad6f444c1415e4d75c494341d507beca1d85..b5cf0c247dc1df94a94e3d944c09f0eaf438d9d2 100644
--- a/Source/bindings/core/v8/V8Initializer.cpp
+++ b/Source/bindings/core/v8/V8Initializer.cpp
@@ -203,8 +203,13 @@ void V8Initializer::reportRejectedPromisesOnMainThread()
static void promiseRejectHandlerInMainThread(v8::PromiseRejectMessage data)
{
ASSERT(isMainThread());
- if (data.GetEvent() != v8::kPromiseRejectWithNoHandler)
+ if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) {
+ rejectedPromisesOnMainThread().handlerAdded(data);
return;
+ }
+
+ ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler);
+
v8::Handle<v8::Promise> promise = data.GetPromise();
v8::Isolate* isolate = promise->GetIsolate();
@@ -249,14 +254,11 @@ static void promiseRejectHandlerInMainThread(v8::PromiseRejectMessage data)
errorMessage = "Uncaught " + messageForConsole;
ScriptState* scriptState = ScriptState::current(isolate);
- rejectedPromisesOnMainThread().add(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, callStack);
+ rejectedPromisesOnMainThread().rejectedWithNoHandler(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, callStack);
}
static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data)
{
- if (data.GetEvent() != v8::kPromiseRejectWithNoHandler)
- return;
-
v8::Handle<v8::Promise> promise = data.GetPromise();
// Bail out if called during context initialization.
@@ -273,6 +275,13 @@ static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data)
WorkerScriptController* scriptController = toWorkerGlobalScope(executionContext)->script();
ASSERT(scriptController);
+ if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) {
+ scriptController->rejectedPromises()->handlerAdded(data);
+ return;
+ }
+
+ ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler);
+
int scriptId = 0;
int lineNumber = 0;
int columnNumber = 0;
@@ -289,7 +298,7 @@ static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data)
// message->Get() can be empty here. https://crbug.com/450330
errorMessage = toCoreStringWithNullCheck(message->Get());
}
- scriptController->rejectedPromises()->add(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, nullptr);
+ scriptController->rejectedPromises()->rejectedWithNoHandler(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, nullptr);
}
static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
« no previous file with comments | « Source/bindings/core/v8/RejectedPromises.cpp ('k') | Source/core/frame/ConsoleTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698