62127d00ae
For now, we revoke a proxy by setting its handler to null (as in the spec). Change the "target" field from Object to JSReceiver as there's no point in allowing more. R=jkummerow@chromium.org, rossberg BUG=v8:1543 LOG=n Review URL: https://codereview.chromium.org/1496243003 Cr-Commit-Position: refs/heads/master@{#32608}
27 lines
779 B
JavaScript
27 lines
779 B
JavaScript
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --harmony-proxies --harmony-reflect
|
|
|
|
|
|
traps = [
|
|
"getPrototypeOf", "setPrototypeOf", "isExtensible", "preventExtensions",
|
|
"getOwnPropertyDescriptor", "has", "get", "set", "deleteProperty",
|
|
"defineProperty", "ownKeys", "apply", "construct"
|
|
];
|
|
// TODO(neis): Fix enumerate.
|
|
|
|
var {proxy, revoke} = Proxy.revocable({}, {});
|
|
assertEquals(0, revoke.length);
|
|
|
|
assertEquals(undefined, revoke());
|
|
for (var trap of traps) {
|
|
assertThrows(() => Reflect[trap](proxy), TypeError);
|
|
}
|
|
|
|
assertEquals(undefined, revoke());
|
|
for (var trap of traps) {
|
|
assertThrows(() => Reflect[trap](proxy), TypeError);
|
|
}
|