js/src/jit-test/tests/pic/callname-global1.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // Check that the implicit-this logic needed for CALLNAME global stubs
     2 // handles non-function values correctly.
     3 var self = this;
     4 var count = 0;
     5 function g1() {
     6     assertEq(this, self);
     7     this.count++;
     8 }
     9 function g2() {
    10     this.count += 10;
    11 }
    12 function f() {
    13     function f1(other) {
    14         eval("gc(); h = g1");
    15         try {
    16             for(var i=0; i<20; i++) {
    17                 h();
    18                 if (i === 9) {
    19                     h = other;
    20                 }
    21             }
    22             assertEq(typeof other, "function");
    23         } catch(e) {
    24             assertEq(typeof other !== "function", true);
    25             assertEq(e instanceof TypeError, true);
    26         }
    27     }
    28     f1(3);
    29     f1(null);
    30     f1({});
    31     f1(Math.abs);
    32     f1(g2);
    33 }
    34 f();
    35 assertEq(count, 150);

mercurial