Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | (function(global, utils) { |
| 6 | |
| 7 | "use strict"; |
| 8 | |
| 9 | %CheckIsBootstrapping(); |
| 10 | |
| 11 | // ---------------------------------------------------------------------------- |
| 12 | // Imports |
| 13 | // |
| 14 | var GlobalProxy = global.Proxy; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 15 | |
| 16 | //---------------------------------------------------------------------------- |
| 17 | |
| 18 | function ProxyCreateRevocable(target, handler) { |
| 19 | var p = new GlobalProxy(target, handler); |
| 20 | return {proxy: p, revoke: () => %JSProxyRevoke(p)}; |
| 21 | } |
| 22 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 23 | //------------------------------------------------------------------- |
| 24 | |
| 25 | //Set up non-enumerable properties of the Proxy object. |
| 26 | utils.InstallFunctions(GlobalProxy, DONT_ENUM, [ |
| 27 | "revocable", ProxyCreateRevocable |
| 28 | ]); |
| 29 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 30 | }) |