Commit 7f8e83b5 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[builtins] Properly reject immediately throwing thenables.

Bug: chromium:830565
Change-Id: I1adab76e790a81f51f7b03165962992f5afecc99
Reviewed-on: https://chromium-review.googlesource.com/1023400
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52748}
parent 363996f7
......@@ -1110,7 +1110,7 @@ TF_BUILTIN(PromiseResolveThenableJob, PromiseBuiltinsAssembler) {
// We need to reject the {thenable}.
Node* const result = CallJS(
CodeFactory::Call(isolate(), ConvertReceiverMode::kNullOrUndefined),
native_context, UndefinedConstant(), var_exception.value());
native_context, reject, UndefinedConstant(), var_exception.value());
Return(result);
}
}
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
testAsync(assert => {
assert.plan(1);
const error = new TypeError('Throwing');
Promise.resolve({ then(resolve, reject) {
throw error;
}}).then(v => {
assert.unreachable();
}, e => {
assert.equals(error, e);
});
});
......@@ -3,6 +3,8 @@ Test whether Promise treats thenable correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
The promise is already rejected now.
PASS rejected
PASS result is "hello"
PASS successfullyParsed is true
TEST COMPLETE
......
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