js/xpconnect/tests/unit/test_isProxy.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:be561a56380a
1 function run_test() {
2 var Cu = Components.utils;
3
4 var handler = {
5 get: function(target, name){
6 return name in target?
7 target[name] :
8 37;
9 }
10 };
11
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));
16
17 sb = new Cu.Sandbox(this,
18 { wantExportHelpers: true });
19
20 do_check_false(Cu.isProxy(sb));
21
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