js/src/jit-test/tests/basic/spread-call-this.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 let global = this;
     2 let p = {};
     3 let q = {};
     5 let g1 = function() {
     6   assertEq(this, global);
     7   assertEq(arguments.callee, g1);
     8 };
     9 g1(...[]);
    11 let g2 = x => {
    12   assertEq(this, global);
    13   // arguments.callee is unbound function object, and following assertion fails.
    14   // see Bug 889158
    15   //assertEq(arguments.callee, g2);
    16 };
    17 g2(...[]);
    19 let g3 = function() {
    20   assertEq(this, p);
    21   assertEq(arguments.callee, g3);
    22 };
    23 g3.apply(p, ...[]);
    24 g3.call(p, ...[]);
    26 g2.apply(p, ...[]);
    27 g2.call(p, ...[]);
    29 let o = {
    30   f1: function() {
    31     assertEq(this, o);
    32     assertEq(arguments.callee, o.f1);
    34     let g1 = function() {
    35       assertEq(this, global);
    36       assertEq(arguments.callee, g1);
    37     };
    38     g1(...[]);
    40     let g2 = x => {
    41       assertEq(this, o);
    42       //assertEq(arguments.callee, g2);
    43     };
    44     g2(...[]);
    46     let g3 = function() {
    47       assertEq(this, q);
    48       assertEq(arguments.callee, g3);
    49     };
    50     g3.apply(q, ...[]);
    51     g3.call(q, ...[]);
    53     let g4 = x => {
    54       assertEq(this, o);
    55       //assertEq(arguments.callee, g4);
    56     };
    57     g4.apply(q, ...[]);
    58     g4.call(q, ...[]);
    59   },
    60   f2: x => {
    61     assertEq(this, global);
    62     //assertEq(arguments.callee, o.f2);
    63     let g1 = function() {
    64       assertEq(this, global);
    65       assertEq(arguments.callee, g1);
    66     };
    67     g1(...[]);
    69     let g2 = x => {
    70       assertEq(this, global);
    71       //assertEq(arguments.callee, g2);
    72     };
    73     g2(...[]);
    75     let g3 = function() {
    76       assertEq(this, q);
    77       assertEq(arguments.callee, g3);
    78     };
    79     g3.apply(q, ...[]);
    80     g3.call(q, ...[]);
    82     let g4 = x => {
    83       assertEq(this, global);
    84       //assertEq(arguments.callee, g4);
    85     };
    86     g4.apply(q, ...[]);
    87     g4.call(q, ...[]);
    88   },
    89   f3: function() {
    90     assertEq(this, p);
    91     assertEq(arguments.callee, o.f3);
    93     let g1 = function() {
    94       assertEq(this, global);
    95       assertEq(arguments.callee, g1);
    96     };
    97     g1(...[]);
    99     let g2 = x => {
   100       assertEq(this, p);
   101       //assertEq(arguments.callee, g2);
   102     };
   103     g2(...[]);
   105     let g3 = function() {
   106       assertEq(this, q);
   107       assertEq(arguments.callee, g3);
   108     };
   109     g3.apply(q, ...[]);
   110     g3.call(q, ...[]);
   112     let g4 = x => {
   113       assertEq(this, p);
   114       //assertEq(arguments.callee, g4);
   115     };
   116     g4.apply(q, ...[]);
   117     g4.call(q, ...[]);
   118   }
   119 };
   120 o.f1(...[]);
   121 o.f2(...[]);
   122 o.f3.apply(p, ...[]);
   123 o.f2.apply(p, ...[]);

mercurial