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

Unified Diff: test/mjsunit/strong/load-proxy.js

Issue 1218123003: Revert of [strong] Add tests for loading from proxy, super, with access checks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « test/mjsunit/strong/load-builtins.js ('k') | test/mjsunit/strong/load-super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strong/load-proxy.js
diff --git a/test/mjsunit/strong/load-proxy.js b/test/mjsunit/strong/load-proxy.js
deleted file mode 100644
index 72904ceb59d54fafd85539de9dd26bfbd0af4fe1..0000000000000000000000000000000000000000
--- a/test/mjsunit/strong/load-proxy.js
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2015 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.
-
-// Flags: --harmony-proxies --strong-mode
-
-// Forwarding proxies adapted from proposal definition
-function handlerMaker1(obj) {
- return {
- getPropertyDescriptor: function(name) {
- var desc;
- var searchObj = obj;
- while (desc === undefined && searchObj != null) {
- desc = Object.getOwnPropertyDescriptor(searchObj, name);
- searchObj = searchObj.__proto__;
- }
- // a trapping proxy's properties must always be configurable
- if (desc !== undefined) { desc.configurable = true; }
- return desc;
- },
- fix: function() {
- if (Object.isFrozen(obj)) {
- var result = {};
- Object.getOwnPropertyNames(obj).forEach(function(name) {
- result[name] = Object.getOwnPropertyDescriptor(obj, name);
- });
- return result;
- }
- // As long as obj is not frozen, the proxy won't allow itself to be fixed
- return undefined; // will cause a TypeError to be thrown
- }
- };
-}
-function handlerMaker2(obj) {
- return {
- get: function(receiver, name) {
- return obj[name];
- },
- fix: function() {
- if (Object.isFrozen(obj)) {
- var result = {};
- Object.getOwnPropertyNames(obj).forEach(function(name) {
- result[name] = Object.getOwnPropertyDescriptor(obj, name);
- });
- return result;
- }
- // As long as obj is not frozen, the proxy won't allow itself to be fixed
- return undefined; // will cause a TypeError to be thrown
- }
- };
-}
-var baseObj = {};
-var proxy1 = Proxy.create(handlerMaker1(baseObj));
-var proxy2 = Proxy.create(handlerMaker2(baseObj));
-var childObj1 = { __proto__: proxy1 };
-var childObj2 = { __proto__: proxy2 };
-var childObjAccessor1 = { set foo(_){}, set "1"(_){}, __proto__: proxy1 };
-var childObjAccessor2 = { set foo(_){}, set "1"(_){}, __proto__: proxy2 };
-
-(function() {
- "use strong";
- // TODO(conradw): These asserts are sanity checking V8's proxy implementation.
- // Strong mode semantics for ES6 proxies still need to be explored.
- assertDoesNotThrow(function(){proxy1.foo});
- assertDoesNotThrow(function(){proxy1[1]});
- assertDoesNotThrow(function(){proxy2.foo});
- assertDoesNotThrow(function(){proxy2[1]});
- assertDoesNotThrow(function(){childObj1.foo});
- assertDoesNotThrow(function(){childObj1[1]});
- assertDoesNotThrow(function(){childObj2.foo});
- assertDoesNotThrow(function(){childObj2[1]});
- assertThrows(function(){baseObj.foo}, TypeError);
- assertThrows(function(){baseObj[1]}, TypeError);
- assertThrows(function(){childObjAccessor1.foo}, TypeError);
- assertThrows(function(){childObjAccessor1[1]}, TypeError);
- assertThrows(function(){childObjAccessor2.foo}, TypeError);
- assertThrows(function(){childObjAccessor2[1]}, TypeError);
-
- // Once the proxy is no longer trapping, property access should have strong
- // semantics.
- Object.freeze(baseObj);
- Object.freeze(proxy1);
- Object.freeze(proxy2);
- assertThrows(function(){proxy1.foo}, TypeError);
- assertThrows(function(){proxy1[1]}, TypeError);
- assertThrows(function(){proxy2.foo}, TypeError);
- assertThrows(function(){proxy2[1]}, TypeError);
- assertThrows(function(){childObj1.foo}, TypeError);
- assertThrows(function(){childObj1[1]}, TypeError);
- assertThrows(function(){childObj2.foo}, TypeError);
- assertThrows(function(){childObj2[1]}, TypeError);
- assertThrows(function(){childObjAccessor1.foo}, TypeError);
- assertThrows(function(){childObjAccessor1[1]}, TypeError);
- assertThrows(function(){childObjAccessor2.foo}, TypeError);
- assertThrows(function(){childObjAccessor2[1]}, TypeError);
-})();
« no previous file with comments | « test/mjsunit/strong/load-builtins.js ('k') | test/mjsunit/strong/load-super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698