From e9fc3db379f0a30cd09aeda5523d82b7877e812f Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Fri, 3 Sep 2021 18:50:39 -0400 Subject: [PATCH] Add test for normative change to TCO&revoked Proxy Normative: phrase tail calls as discarding resources rather than popping execution context stack https://github.com/tc39/ecma262/pull/2495 --- .../built-ins/Proxy/revocable/tco-fn-realm.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/built-ins/Proxy/revocable/tco-fn-realm.js diff --git a/test/built-ins/Proxy/revocable/tco-fn-realm.js b/test/built-ins/Proxy/revocable/tco-fn-realm.js new file mode 100644 index 0000000000..493fca63c6 --- /dev/null +++ b/test/built-ins/Proxy/revocable/tco-fn-realm.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Realm of the TypeError from invoking a revoked Proxy during tail-call + optimization +esid: sec-tail-position-calls +flags: [onlyStrict] +features: [Proxy, tail-call-optimization] +---*/ + +var other = $262.createRealm(); +var F = other.evalScript(` + (function() { + var { proxy, revoke } = Proxy.revocable(function() {}, {}); + revoke(); + return proxy(); + }) +`); + +assert.throws(other.global.TypeError, function() { + F(); +});