Commit 1c4a9193 authored by aandrey's avatar aandrey Committed by Commit bot

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}
parent 91ed586e
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment