Reviewers: ulan, Yang,
Description:
Add a missing DebugPromiseEvent in promise.js
DevTools expects 2 events on Promise.resolve()/Promise.reject():
creation & settlement. The first one was missing.
[email protected], [email protected]
LOG=N
Please review this at https://codereview.chromium.org/792383003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+9, -2 lines):
M src/promise.js
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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.