summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxySet1.js
blob: ddc1bc5ddc0ad6219199fa15fe762b8f2a04d43c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Forward to the target if the trap is not defined
var target = {
    foo: 'bar'
};
for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) {
    // The sets from the first iteration will affect target, but it doesn't
    // matter, since the effectiveness of the foo sets is still observable.
    p.foo = 'baz';
    assertEq(target.foo, 'baz');
    p['foo'] = 'buz';
    assertEq(target.foo, 'buz');

    var sym = Symbol.for('quux');
    p[sym] = sym;
    assertEq(target[sym], sym);
    // Reset for second iteration
    target[sym] = undefined;
}