js/xpconnect/tests/unit/test_isProxy.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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