tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

resolve-non-callable.js (1003B)


      1 // |reftest| async
      2 // Copyright (C) 2020 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-promise.all
      7 description: >
      8  Promise.resolve is retrieved before GetIterator call (non-callable).
      9 info: |
     10  Promise.all ( iterable )
     11 
     12  [...]
     13  3. Let promiseResolve be GetPromiseResolve(C).
     14  4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
     15 
     16  GetPromiseResolve ( promiseConstructor )
     17 
     18  [...]
     19  2. Let promiseResolve be ? Get(promiseConstructor, "resolve").
     20  3. If IsCallable(promiseResolve) is false, throw a TypeError exception.
     21 flags: [async]
     22 features: [Symbol.iterator]
     23 ---*/
     24 
     25 const iter = { 
     26  get [Symbol.iterator]() {
     27    throw new Test262Error("unreachable");
     28  },
     29 };
     30 
     31 Promise.resolve = "certainly not callable";
     32 
     33 Promise.all(iter).then(() => {
     34  throw new Test262Error("The promise should be rejected, but it was resolved");
     35 }, (reason) => {
     36  assert(reason instanceof TypeError);
     37 }).then($DONE, $DONE);