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

Unified Diff: test/mjsunit/harmony/regress/regress-2225.js

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fix protoype walks with access checks 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
Index: test/mjsunit/harmony/regress/regress-2225.js
diff --git a/test/mjsunit/harmony/regress/regress-2225.js b/test/mjsunit/harmony/regress/regress-2225.js
index 12d3eee116a0c4ddd0269cb08832374b58df912e..75778753b27ca4cfb2d2209e6679883f72712faf 100644
--- a/test/mjsunit/harmony/regress/regress-2225.js
+++ b/test/mjsunit/harmony/regress/regress-2225.js
@@ -28,12 +28,13 @@
// Flags: --harmony-proxies
var proxy_has_x = false;
-var proxy = new Proxy({}, { getPropertyDescriptor:function(key) {
- assertSame('x', key);
- if (proxy_has_x) {
- return { configurable:true, writable:false, value:19 };
+var proxy = new Proxy({}, {
+ get(t, key, receiver) {
+ assertSame('x', key);
+ if (proxy_has_x) { return 19 }
+ return 8;
}
-}});
+});
// Test __lookupGetter__/__lookupSetter__ with proxy.
assertSame(undefined, Object.prototype.__lookupGetter__.call(proxy, 'foo'));
@@ -49,17 +50,27 @@ assertSame(undefined, Object.prototype.__lookupGetter__.call(object, '123'));
assertSame(undefined, Object.prototype.__lookupSetter__.call(object, '456'));
// Test inline constructors with proxy as prototype.
-function f() { this.x = 23; }
-f.prototype = proxy;
+function F() { this.x = 42 }
+F.prototype = proxy;
+var instance = new F();
+
proxy_has_x = false;
-assertSame(23, new f().x);
+assertSame(42, instance.x);
+delete instance.x;
+assertSame(8, instance.x);
+
proxy_has_x = true;
-assertSame(19, new f().x);
+assertSame(19, instance.x);
// Test inline constructors with proxy in prototype chain.
-function g() { this.x = 42; }
-g.prototype.__proto__ = proxy;
+function G() { this.x = 42; }
+G.prototype.__proto__ = proxy;
+instance = new G();
+
proxy_has_x = false;
-assertSame(42, new g().x);
+assertSame(42, instance.x);
+delete instance.x;
+assertSame(8, instance.x);
+
proxy_has_x = true;
-assertSame(19, new g().x);
+assertSame(19, instance.x);

Powered by Google App Engine
This is Rietveld 408576698