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

Unified Diff: src/promise.js

Issue 792383003: Add a missing DebugPromiseEvent in promise.js (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index d38cdaa482487e84aaf65f1b021bb457bf48a319..c096296b0eb2b48696dc2490e70c2f7243cad653 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -67,6 +67,13 @@ var lastMicrotaskId = 0;
return promise;
}
+ function PromiseCreateAndSet(status, value) {
+ var promise = new $Promise(promiseRaw);
+ // If debug is active, notify about the newly created promise first.
+ if (DEBUG_IS_ACTIVE) PromiseSet(promise, 0, UNDEFINED);
+ return PromiseSet(promise, status, value);
+ }
+
function PromiseInit(promise) {
return PromiseSet(
promise, 0, UNDEFINED, new InternalArray, new InternalArray)
@@ -197,7 +204,7 @@ var lastMicrotaskId = 0;
function PromiseResolved(x) {
if (this === $Promise) {
// Optimized case, avoid extra closure.
- return PromiseSet(new $Promise(promiseRaw), +1, x);
+ return PromiseCreateAndSet(+1, x);
} else {
return new this(function(resolve, reject) { resolve(x) });
}
@@ -207,7 +214,7 @@ var lastMicrotaskId = 0;
var promise;
if (this === $Promise) {
// Optimized case, avoid extra closure.
- promise = PromiseSet(new $Promise(promiseRaw), -1, r);
+ promise = PromiseCreateAndSet(-1, r);
// The debug event for this would always be an uncaught promise reject,
// which is usually simply noise. Do not trigger that debug event.
%PromiseRejectEvent(promise, r, false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698