summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/proxy-revoke.tq
blob: d89b54077ae109e3b8bb7492a427874a8ae1490f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2019 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.

#include 'src/builtins/builtins-proxy-gen.h'

namespace proxy {

  // Proxy Revocation Functions
  // https://tc39.github.io/ecma262/#sec-proxy-revocation-functions
  transitioning javascript builtin
  ProxyRevoke(js-implicit context: Context)(): Undefined {
    // 1. Let p be F.[[RevocableProxy]].
    const proxyObject: Object = context[PROXY_SLOT];

    // 2. If p is null, return undefined
    if (proxyObject == Null) {
      return Undefined;
    }

    // 3. Set F.[[RevocableProxy]] to null.
    context[PROXY_SLOT] = Null;

    // 4. Assert: p is a Proxy object.
    const proxy: JSProxy = UnsafeCast<JSProxy>(proxyObject);

    // 5. Set p.[[ProxyTarget]] to null.
    proxy.target = Null;

    // 6. Set p.[[ProxyHandler]] to null.
    proxy.handler = Null;

    // 7. Return undefined.
    return Undefined;
  }
}