v8/test/mjsunit/es6/proxies-revocable.js
Shu-yu Guo ce43feb566 Allow Proxy constructor to take revoked Proxies as targets and handlers
Normative spec change: https://github.com/tc39/ecma262/pull/1814

Bug: v8:10382
Change-Id: Ib17ece9f0c8f75702c828b5336e75cab5d173e5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2163876
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67376}
2020-04-24 19:16:21 +00:00

24 lines
702 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.
traps = [
"getPrototypeOf", "setPrototypeOf", "isExtensible", "preventExtensions",
"getOwnPropertyDescriptor", "has", "get", "set", "deleteProperty",
"defineProperty", "ownKeys", "apply", "construct"
];
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);
}