From 08d2018808074bcff2270b4abfbe47898ae123a3 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 23 Jun 2021 22:21:40 -0700 Subject: [PATCH] Editorial: use abstract closure in Proxy.revocable (#2439) --- spec.html | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/spec.html b/spec.html index 3c9734e9af..0dd475c343 100644 --- a/spec.html +++ b/spec.html @@ -40466,27 +40466,12 @@

Properties of the Proxy Constructor

  • has the following properties:
  • - +

    Proxy.revocable ( _target_, _handler_ )

    The `Proxy.revocable` function is used to create a revocable Proxy object. When `Proxy.revocable` is called with arguments _target_ and _handler_, the following steps are taken:

    1. Let _p_ be ? ProxyCreate(_target_, _handler_). - 1. Let _steps_ be the algorithm steps defined in . - 1. Let _length_ be the number of non-optional parameters of the function definition in . - 1. Let _revoker_ be ! CreateBuiltinFunction(_steps_, _length_, *""*, « [[RevocableProxy]] »). - 1. Set _revoker_.[[RevocableProxy]] to _p_. - 1. Let _result_ be ! OrdinaryObjectCreate(%Object.prototype%). - 1. Perform ! CreateDataPropertyOrThrow(_result_, *"proxy"*, _p_). - 1. Perform ! CreateDataPropertyOrThrow(_result_, *"revoke"*, _revoker_). - 1. Return _result_. - - - -

    Proxy Revocation Functions

    -

    A Proxy revocation function is an anonymous built-in function that has the ability to invalidate a specific Proxy object.

    -

    Each Proxy revocation function has a [[RevocableProxy]] internal slot.

    -

    When a Proxy revocation function is called, the following steps are taken:

    - + 1. Let _revokerClosure_ be a new Abstract Closure with no parameters that captures nothing and performs the following steps when called: 1. Let _F_ be the active function object. 1. Let _p_ be _F_.[[RevocableProxy]]. 1. If _p_ is *null*, return *undefined*. @@ -40495,9 +40480,13 @@

    Proxy Revocation Functions

    1. Set _p_.[[ProxyTarget]] to *null*. 1. Set _p_.[[ProxyHandler]] to *null*. 1. Return *undefined*. -
    -

    The *"length"* property of a Proxy revocation function is *+0*𝔽.

    -
    + 1. Let _revoker_ be ! CreateBuiltinFunction(_revokerClosure_, 0, *""*, « [[RevocableProxy]] »). + 1. Set _revoker_.[[RevocableProxy]] to _p_. + 1. Let _result_ be ! OrdinaryObjectCreate(%Object.prototype%). + 1. Perform ! CreateDataPropertyOrThrow(_result_, *"proxy"*, _p_). + 1. Perform ! CreateDataPropertyOrThrow(_result_, *"revoke"*, _revoker_). + 1. Return _result_. +