tor-browser

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

call-target.js (985B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 26.1.1
      5 description: >
      6  Call target with thisArgument and argumentsList
      7 info: |
      8  26.1.1 Reflect.apply ( target, thisArgument, argumentsList )
      9 
     10  ...
     11  4. Perform PrepareForTailCall().
     12  5. Return Call(target, thisArgument, args).
     13 features: [Reflect]
     14 ---*/
     15 
     16 var o = {};
     17 var count = 0;
     18 var results, args;
     19 
     20 function fn() {
     21  count++;
     22  results = {
     23    thisArg: this,
     24    args: arguments
     25  };
     26 }
     27 
     28 Reflect.apply(fn, o, ['arg1', 2, , null]);
     29 
     30 assert.sameValue(count, 1, 'Called target once');
     31 assert.sameValue(results.thisArg, o, 'Called target with `o` as `this` object');
     32 assert.sameValue(results.args.length, 4, 'Called target with 4 arguments');
     33 assert.sameValue(results.args[0], 'arg1');
     34 assert.sameValue(results.args[1], 2);
     35 assert.sameValue(results.args[2], undefined);
     36 assert.sameValue(results.args[3], null);
     37 
     38 reportCompare(0, 0);