js/src/jit-test/tests/baseline/bug892787-2.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 // Constructing calls should throw if !callee->isInterpretedConstructor().
     2 // This tests the polymorphic call path.
     4 for (var i=0; i<20; i++)
     5     Function.prototype();
     7 var funs = [
     8     function() { return 1; },
     9     function() { return 2; },
    10     function() { return 3; },
    11     function() { return 4; },
    12     function() { return 5; },
    13     function() { return 6; },
    14     function() { return 7; },
    15     function() { return 8; },
    16     function() { return 9; },
    17     function() { return 10; },
    18     Function.prototype
    19 ];
    21 function f(callee) {
    22     new callee;
    23 }
    24 function g() {
    25     var c = 0;
    26     for (var i=0; i<50; i++) {
    27 	try {
    28 	    f(funs[i % funs.length]);
    29 	} catch (e) {
    30 	    assertEq(e.message.contains("not a constructor"), true);
    31 	    c++;
    32 	}
    33     }
    34     assertEq(c, 4);
    35 }
    36 g();

mercurial