js/src/tests/js1_8_5/extensions/regress-604781-1.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 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     4 var watcherCount, setterCount;
     5 function watcher(id, oldval, newval) { watcherCount++; return newval; }
     6 function setter(newval) { setterCount++; }
     8 var p = { set x(v) { setter(v); } };
     9 p.watch('x', watcher);
    11 watcherCount = setterCount = 0;
    12 p.x = 2;
    13 assertEq(setterCount, 1);
    14 assertEq(watcherCount, 1);
    16 var o = Object.defineProperty({}, 'x', { set:setter, enumerable:true, configurable:true });
    17 o.watch('x', watcher);
    19 watcherCount = setterCount = 0;
    20 o.x = 2;
    21 assertEq(setterCount, 1);
    22 assertEq(watcherCount, 1);
    24 reportCompare(0, 0, 'ok');

mercurial