Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: src/js/proxy.js

Issue 1496243003: [proxies] Implement Proxy.revocable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/proxy.js
diff --git a/src/js/proxy.js b/src/js/proxy.js
index 2750d40e272f27d3b0a49a0897e25cfbacf2f649..90f5bdd2067c2949bfd8f81254808636556d876f 100644
--- a/src/js/proxy.js
+++ b/src/js/proxy.js
@@ -42,6 +42,11 @@ function ProxyCreateFunction(handler, callTrap, constructTrap) {
{}, handler, callTrap, constructTrap, GlobalFunction.prototype)
}
+function ProxyCreateRevocable(target, handler) {
+ var p = new GlobalProxy(target, handler);
+ return {proxy: p, revoke: () => %RevokeProxy(p)};
+}
+
// -------------------------------------------------------------------
// Proxy Builtins
@@ -144,6 +149,7 @@ function ProxyEnumerate(trap, handler, target) {
//Set up non-enumerable properties of the Proxy object.
utils.InstallFunctions(GlobalProxy, DONT_ENUM, [
+ "revocable", ProxyCreateRevocable,
"createFunction", ProxyCreateFunction
]);
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698