Welcome to mirror list, hosted at ThFree Co, Russian Federation.

proxy-revoke.tq « builtins « src « v8 « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7300f4d7179e70452e5b54b6c48d0d4e7fb32520 (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: NativeContext)(): 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;
  }
}