tor-browser

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

executor-function-property-order.js (742B)


      1 // Copyright (C) 2020 ExE Boss. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-createbuiltinfunction
      5 description: Promise executor function property order
      6 info: |
      7  Set order: "length", "name"
      8 ---*/
      9 
     10 var executorFunction;
     11 
     12 function NotPromise(executor) {
     13  executorFunction = executor;
     14  executor(function() {}, function() {});
     15 }
     16 Promise.resolve.call(NotPromise);
     17 
     18 var propNames = Object.getOwnPropertyNames(executorFunction);
     19 var lengthIndex = propNames.indexOf("length");
     20 var nameIndex = propNames.indexOf("name");
     21 
     22 assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
     23  "The `length` property comes before the `name` property on built-in functions");
     24 
     25 reportCompare(0, 0);