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

Unified Diff: test/mjsunit/es6/global-proto-proxy.js

Issue 2671553006: Allow global prototype to be a Proxy (Closed)
Patch Set: Allow global prototype to be a Proxy Created 3 years, 10 months 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
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/global-proto-proxy.js
diff --git a/test/mjsunit/es6/global-proto-proxy.js b/test/mjsunit/es6/global-proto-proxy.js
new file mode 100644
index 0000000000000000000000000000000000000000..8de1a7ae0dde7ed34cb4c50d63ae7de1e118ce42
--- /dev/null
+++ b/test/mjsunit/es6/global-proto-proxy.js
@@ -0,0 +1,41 @@
+// Copyright 2017 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.
+
+var global = this;
+;(function () {
+ var calledDelete = false;
+ var calledGet = false;
+ var calledHas = false;
+ var calledSet = false;
+ var target = {};
+ var assertEquals = global.assertEquals;
+ var proxy = new Proxy(target, {
+ has(target, property) {
+ calledHas = true;
+ return Reflect.has(target, property);
+ },
+ get(target, property, receiver) {
+ calledGet = true;
+ return Reflect.get(target, property, receiver);
+ },
+ set(targer, property, value, receiver) {
+ calledSet = true;
+ return Reflect.set(target, property, value, receiver);
+ },
+ delete(target, property, receiver) {
+ calledDelete = true;
+ return Reflect.delete(target, property, receiver);
+ }
+ });
+ Object.setPrototypeOf(global, proxy);
+ getGlobal;
+ assertTrue(calledGet);
+ makeGlobal = 2;
+ assertTrue(calledSet);
+ "findGlobal" in global;
+ assertTrue(calledHas);
+ var deletedOwn = delete makeGlobal;
+ assertTrue(deletedOwn);
+ assertEquals(void 0, makeGlobal);
+})();
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698