summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyPreventExtensions2.js
blob: 42591e22c37e6f995100e7058490eaf459197fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Call the trap with the handler as the this value and the target as the first
 * argument.
 */
var target = {};
var handler = {
    preventExtensions: function (target1) {
        assertEq(this, handler);
        assertEq(target1, target);
        Object.preventExtensions(target1);
        called = true;
        return true;
    }
};

var proxy = new Proxy(target, handler);
var called = false;
Object.preventExtensions(proxy);
assertEq(called, true);

target = {};
proxy = Proxy.revocable(target, handler).proxy;
called = false;
Object.preventExtensions(proxy);
assertEq(called, true);