|
|
@@ -9,39 +9,37 @@ var tests = [
|
|
|
{
|
|
|
name: "Object.prototype.__lookupGetter__ -> [[GetOwnProperty]], [[GetPrototypeOf]]",
|
|
|
body: function () {
|
|
|
- assert.isTrue((function()
|
|
|
+ // Object.prototype.__lookupGetter__ -> [[GetOwnProperty]]
|
|
|
+ // Object.prototype.__lookupGetter__ -> [[GetPrototypeOf]]
|
|
|
+ var gopd = [];
|
|
|
+ var gpo = false;
|
|
|
+ var p = new Proxy({},
|
|
|
{
|
|
|
- // Object.prototype.__lookupGetter__ -> [[GetOwnProperty]]
|
|
|
- // Object.prototype.__lookupGetter__ -> [[GetPrototypeOf]]
|
|
|
- var gopd = [];
|
|
|
- var gpo = false;
|
|
|
- var p = new Proxy({},
|
|
|
- {
|
|
|
- getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },
|
|
|
- getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }
|
|
|
- });
|
|
|
- Object.prototype.__lookupGetter__.call(p, "foo");
|
|
|
- return gopd + '' === "foo" && gpo;
|
|
|
- })());
|
|
|
+ getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },
|
|
|
+ getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }
|
|
|
+ });
|
|
|
+ Object.prototype.__lookupGetter__.call(p, "foo");
|
|
|
+ assert.areEqual(1, gopd.length, "getOwnPropertyDescriptor should only be called once");
|
|
|
+ assert.areEqual("foo", gopd[0], "getOwnPropertyDescriptor should be called with foo");
|
|
|
+ assert.isTrue(gpo, "getPrototypeOf should be called");
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
name: "Object.prototype.__lookupSetter__ -> [[GetOwnProperty]], [[GetPrototypeOf]]",
|
|
|
body: function () {
|
|
|
- assert.isTrue((function()
|
|
|
+ // Object.prototype.__lookupSetter__ -> [[GetOwnProperty]]
|
|
|
+ // Object.prototype.__lookupSetter__ -> [[GetPrototypeOf]]
|
|
|
+ var gopd = [];
|
|
|
+ var gpo = false;
|
|
|
+ var p = new Proxy({},
|
|
|
{
|
|
|
- // Object.prototype.__lookupSetter__ -> [[GetOwnProperty]]
|
|
|
- // Object.prototype.__lookupSetter__ -> [[GetPrototypeOf]]
|
|
|
- var gopd = [];
|
|
|
- var gpo = false;
|
|
|
- var p = new Proxy({},
|
|
|
- {
|
|
|
- getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },
|
|
|
- getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }
|
|
|
- });
|
|
|
- Object.prototype.__lookupSetter__.call(p, "foo");
|
|
|
- return gopd + '' === "foo" && gpo;
|
|
|
- })());
|
|
|
+ getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },
|
|
|
+ getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }
|
|
|
+ });
|
|
|
+ Object.prototype.__lookupSetter__.call(p, "foo");
|
|
|
+ assert.areEqual(1, gopd.length, "getOwnPropertyDescriptor should only be called once");
|
|
|
+ assert.areEqual("foo", gopd[0], "getOwnPropertyDescriptor should be called with foo");
|
|
|
+ assert.isTrue(gpo, "getPrototypeOf should be called");
|
|
|
}
|
|
|
}
|
|
|
];
|