v8/test/mjsunit/regress/regress-v8-12705.js
jameslahm 39c3a97e84 [builtin] Throw type error when HasAccessCheckFailed in PromiseConstructor.
When cross realm invoke PromiseConstructor and realm not
allowed to CrossRealmAccess, PromiseConstructor will
silently return undefined, which will cause crash in
ConstructJSWithTarget type cast, Change to throw type
error when HasAccessCheck failed.

Bug: v8:12705
Change-Id: I18f697a1897c31163dd60522db12449033419f9a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3521174
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79548}
2022-03-21 13:55:03 +00:00

12 lines
364 B
JavaScript

// Copyright 2022 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.
const r = Realm.create();
const otherPromise = Realm.eval(r, 'Promise.resolve()');
assertThrows(
() => {
Promise.prototype.then.call(otherPromise, () => { });
}, TypeError, 'no access');