js/src/jit-test/tests/collections/Set-surfaces-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 // Set methods throw when passed a this-value that isn't a Set.
     3 load(libdir + "asserts.js");
     5 function testcase(obj, fn) {
     6     assertEq(typeof fn, "function");
     7     var args = Array.slice(arguments, 2);
     8     assertThrowsInstanceOf(function () { fn.apply(obj, args); }, TypeError);
     9 }
    11 var Set_size_getter = Object.getOwnPropertyDescriptor(Set.prototype, "size").get;
    13 function test(obj) {
    14     testcase(obj, Set.prototype.has, 12);
    15     testcase(obj, Set.prototype.add, 12);
    16     testcase(obj, Set.prototype.delete, 12);
    17     testcase(obj, Set.prototype.clear);
    18     testcase(obj, Set.prototype.keys);
    19     testcase(obj, Set.prototype.values);
    20     testcase(obj, Set.prototype.entries);
    21     testcase(obj, Set_size_getter);
    22 }
    24 test(Set.prototype);
    25 test(Object.create(new Set));
    26 test(new Map());
    27 test({});
    28 test(null);
    29 test(undefined);

mercurial