Commit e3790896 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[promise] Remove IsPromise brand check in PromiseFinally

The IsPromise brand check is now replaced with an IsObject check.

The spec was changed here:
https://github.com/tc39/proposal-promise-finally/commit/a1628886f85a897df5cd967ea36f025e8f89cb7a

Bug: v8:7095
Change-Id: I5668083c888f9efcdfc1491c919c810c75d73ac7
Reviewed-on: https://chromium-review.googlesource.com/826606Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50108}
parent 2031503a
...@@ -1683,9 +1683,9 @@ TF_BUILTIN(PromiseFinally, PromiseBuiltinsAssembler) { ...@@ -1683,9 +1683,9 @@ TF_BUILTIN(PromiseFinally, PromiseBuiltinsAssembler) {
Node* const on_finally = Parameter(Descriptor::kOnFinally); Node* const on_finally = Parameter(Descriptor::kOnFinally);
Node* const context = Parameter(Descriptor::kContext); Node* const context = Parameter(Descriptor::kContext);
// 2. If IsPromise(promise) is false, throw a TypeError exception. // 2. If Type(promise) is not Object, throw a TypeError exception.
ThrowIfNotInstanceType(context, promise, JS_PROMISE_TYPE, ThrowIfNotJSReceiver(context, promise, MessageTemplate::kCalledOnNonObject,
"Promise.prototype.finally"); "Promise.prototype.finally");
// 3. Let C be ? SpeciesConstructor(promise, %Promise%). // 3. Let C be ? SpeciesConstructor(promise, %Promise%).
Node* const native_context = LoadNativeContext(context); Node* const native_context = LoadNativeContext(context);
......
...@@ -605,3 +605,13 @@ testAsync(assert => { ...@@ -605,3 +605,13 @@ testAsync(assert => {
.then(() => assert.equals(1, value)); .then(() => assert.equals(1, value));
}, "PromiseResolve-ordering"); }, "PromiseResolve-ordering");
(function testIsObject() {
var called = false;
var p = new Proxy(Promise.resolve(), {});
var oldThen = Promise.prototype.then;
Promise.prototype.then = () => called = true;
Promise.prototype.finally.call(p);
assertTrue(called);
Promise.prototype.then = oldThen;
})();
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