Add a missing DebugPromiseEvent in promise.js
DevTools expects 2 events on Promise.resolve()/Promise.reject(): creation & settlement. The first one was missing. R=ulan@chromium.org, yangguo@chromium.org LOG=N Review URL: https://codereview.chromium.org/792383003 Cr-Commit-Position: refs/heads/master@{#25778}
This commit is contained in:
parent
91ed586ec2
commit
1c4a9193cc
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user