js/src/jit-test/tests/basic/testNewString.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 function testNewString()
     2 {
     3   var o = { toString: function() { return "string"; } };
     4   var r = [];
     5   for (var i = 0; i < 5; i++)
     6     r.push(typeof new String(o));
     7   for (var i = 0; i < 5; i++)
     8     r.push(typeof new String(3));
     9   for (var i = 0; i < 5; i++)
    10     r.push(typeof new String(2.5));
    11   for (var i = 0; i < 5; i++)
    12     r.push(typeof new String("string"));
    13   for (var i = 0; i < 5; i++)
    14     r.push(typeof new String(null));
    15   for (var i = 0; i < 5; i++)
    16     r.push(typeof new String(true));
    17   for (var i = 0; i < 5; i++)
    18     r.push(typeof new String(undefined));
    19   return r.length === 35 && r.every(function(v) { return v === "object"; });
    20 }
    21 assertEq(testNewString(), true);

mercurial