js/xpconnect/tests/unit/test_isProxy.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 run_test() {
     2   var Cu = Components.utils;
     4   var handler = {
     5       get: function(target, name){
     6           return name in target?
     7               target[name] :
     8               37;
     9       }
    10   };
    12   var p = new Proxy({}, handler);
    13   do_check_true(Cu.isProxy(p));
    14   do_check_false(Cu.isProxy({}));
    15   do_check_false(Cu.isProxy(42));
    17   sb = new Cu.Sandbox(this,
    18                       { wantExportHelpers: true });
    20   do_check_false(Cu.isProxy(sb));
    22   sb.do_check_true = do_check_true;
    23   sb.do_check_false = do_check_false;
    24   sb.p = p;
    25   Cu.evalInSandbox('do_check_true(isProxy(p));' +
    26                    'do_check_false(isProxy({}));' +
    27                    'do_check_false(isProxy(42));',
    28                    sb);
    29 }

mercurial