mirror of https://github.com/tc39/test262.git
built-ins/Proxy/*: make all indentation consistent (depth & character) (#1434)
This commit is contained in:
parent
133dfa8793
commit
4fd36e7f1d
|
@ -12,14 +12,16 @@ info: |
|
|||
---*/
|
||||
|
||||
var _target, _args, _handler, _context;
|
||||
var target = function(a, b) { return a + b; };
|
||||
var target = function(a, b) {
|
||||
return a + b;
|
||||
};
|
||||
var handler = {
|
||||
apply: function(t, c, args) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_context = c;
|
||||
_args = args;
|
||||
}
|
||||
apply: function(t, c, args) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_context = c;
|
||||
_args = args;
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
|
|
@ -10,12 +10,14 @@ info: |
|
|||
9. Return Call(trap, handler, «target, thisArgument, argArray»).
|
||||
---*/
|
||||
|
||||
var target = function(a, b) { return a + b; };
|
||||
var target = function(a, b) {
|
||||
return a + b;
|
||||
};
|
||||
var result = {};
|
||||
var handler = {
|
||||
apply: function(t, c, args) {
|
||||
return result;
|
||||
}
|
||||
apply: function(t, c, args) {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ var p = Proxy.revocable(function() {}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.proxy();
|
||||
p.proxy();
|
||||
});
|
||||
|
|
|
@ -6,13 +6,15 @@ description: >
|
|||
Return is an abrupt completion
|
||||
---*/
|
||||
|
||||
var target = function(a, b) { return a + b; };
|
||||
var target = function(a, b) {
|
||||
return a + b;
|
||||
};
|
||||
var p = new Proxy(target, {
|
||||
apply: function(t, c, args) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
apply: function(t, c, args) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
p.call();
|
||||
p.call();
|
||||
});
|
||||
|
|
|
@ -7,9 +7,9 @@ description: >
|
|||
---*/
|
||||
|
||||
var p = new Proxy(function() {}, {
|
||||
apply: {}
|
||||
apply: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p();
|
||||
p();
|
||||
});
|
||||
|
|
|
@ -31,7 +31,9 @@ function target(a, b) {
|
|||
}
|
||||
|
||||
var ctx = {};
|
||||
var p = new Proxy(target, {apply: null});
|
||||
var p = new Proxy(target, {
|
||||
apply: null
|
||||
});
|
||||
var res = p.call(ctx, 1, 2);
|
||||
assert.sameValue(res, 3, "`apply` trap is `null`");
|
||||
assert.sameValue(calls, 1, "target is called once");
|
||||
|
|
|
@ -25,9 +25,9 @@ info: |
|
|||
var calls = 0;
|
||||
|
||||
function target(a, b) {
|
||||
assert.sameValue(this, ctx);
|
||||
calls += 1;
|
||||
return a + b;
|
||||
assert.sameValue(this, ctx);
|
||||
calls += 1;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
var ctx = {};
|
||||
|
|
|
@ -31,7 +31,9 @@ function target(a, b) {
|
|||
}
|
||||
|
||||
var ctx = {};
|
||||
var p = new Proxy(target, {apply: undefined});
|
||||
var p = new Proxy(target, {
|
||||
apply: undefined
|
||||
});
|
||||
var res = p.call(ctx, 1, 2);
|
||||
assert.sameValue(res, 3, "`apply` trap is `null`");
|
||||
assert.sameValue(calls, 1, "target is called once");
|
||||
|
|
|
@ -15,22 +15,25 @@ features: [Reflect.construct]
|
|||
---*/
|
||||
|
||||
function Target() {}
|
||||
|
||||
function NewTarget() {}
|
||||
|
||||
var handler = {
|
||||
construct: function(target, args, newTarget) {
|
||||
assert.sameValue(this, handler, "trap context is the handler object");
|
||||
assert.sameValue(target, Target, "first parameter is the target object");
|
||||
assert.sameValue(args.length, 2, "arguments list contains all construct arguments");
|
||||
construct: function(target, args, newTarget) {
|
||||
assert.sameValue(this, handler, "trap context is the handler object");
|
||||
assert.sameValue(target, Target, "first parameter is the target object");
|
||||
assert.sameValue(args.length, 2, "arguments list contains all construct arguments");
|
||||
|
||||
var a = args[0];
|
||||
var b = args[1];
|
||||
assert.sameValue(a, 1, "arguments list has first construct argument");
|
||||
assert.sameValue(b, 2, "arguments list has second construct argument");
|
||||
assert.sameValue(newTarget, NewTarget, "newTarget is passed as the third parameter");
|
||||
var a = args[0];
|
||||
var b = args[1];
|
||||
assert.sameValue(a, 1, "arguments list has first construct argument");
|
||||
assert.sameValue(b, 2, "arguments list has second construct argument");
|
||||
assert.sameValue(newTarget, NewTarget, "newTarget is passed as the third parameter");
|
||||
|
||||
return {sum: a + b};
|
||||
},
|
||||
return {
|
||||
sum: a + b
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
var P = new Proxy(Target, handler);
|
||||
|
|
|
@ -13,17 +13,18 @@ info: |
|
|||
---*/
|
||||
|
||||
var _target, _handler, _args, _P;
|
||||
|
||||
function Target() {}
|
||||
|
||||
var handler = {
|
||||
construct: function(t, args, newTarget) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_args = args;
|
||||
_P = newTarget;
|
||||
construct: function(t, args, newTarget) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_args = args;
|
||||
_P = newTarget;
|
||||
|
||||
return new t(args[0], args[1]);
|
||||
}
|
||||
return new t(args[0], args[1]);
|
||||
}
|
||||
};
|
||||
var P = new Proxy(Target, handler);
|
||||
|
||||
|
|
|
@ -11,12 +11,14 @@ info: |
|
|||
---*/
|
||||
|
||||
function Target(a, b) {
|
||||
this.sum = a + b;
|
||||
this.sum = a + b;
|
||||
};
|
||||
var handler = {
|
||||
construct: function(t, c, args) {
|
||||
return { sum: 42 };
|
||||
}
|
||||
construct: function(t, c, args) {
|
||||
return {
|
||||
sum: 42
|
||||
};
|
||||
}
|
||||
};
|
||||
var P = new Proxy(Target, handler);
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ var p = Proxy.revocable(function() {}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new p.proxy();
|
||||
new p.proxy();
|
||||
});
|
||||
|
|
|
@ -13,11 +13,11 @@ info: |
|
|||
|
||||
function Target() {}
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
construct: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -11,14 +11,14 @@ info: |
|
|||
---*/
|
||||
|
||||
function Target() {
|
||||
this.attr = "done";
|
||||
this.attr = "done";
|
||||
};
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
return true;
|
||||
}
|
||||
construct: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -11,14 +11,14 @@ info: |
|
|||
---*/
|
||||
|
||||
function Target() {
|
||||
this.attr = "done";
|
||||
this.attr = "done";
|
||||
};
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
return 0;
|
||||
}
|
||||
construct: function() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -11,14 +11,14 @@ info: |
|
|||
---*/
|
||||
|
||||
function Target() {
|
||||
this.attr = "done";
|
||||
this.attr = "done";
|
||||
};
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
return "";
|
||||
}
|
||||
construct: function() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -12,14 +12,14 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
function Target() {
|
||||
this.attr = "done";
|
||||
this.attr = "done";
|
||||
};
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
return Symbol();
|
||||
}
|
||||
construct: function() {
|
||||
return Symbol();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -11,14 +11,14 @@ info: |
|
|||
---*/
|
||||
|
||||
function Target() {
|
||||
this.attr = "done";
|
||||
this.attr = "done";
|
||||
};
|
||||
var P = new Proxy(Target, {
|
||||
construct: function() {
|
||||
return undefined;
|
||||
}
|
||||
construct: function() {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new P();
|
||||
new P();
|
||||
});
|
||||
|
|
|
@ -8,9 +8,9 @@ description: >
|
|||
|
||||
function Target() {}
|
||||
var p = new Proxy(Target, {
|
||||
construct: {}
|
||||
construct: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new p();
|
||||
new p();
|
||||
});
|
||||
|
|
|
@ -27,13 +27,18 @@ features: [Reflect.construct]
|
|||
var calls = 0;
|
||||
|
||||
function NewTarget() {}
|
||||
|
||||
function Target(a, b) {
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {sum: a + b};
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {
|
||||
sum: a + b
|
||||
};
|
||||
}
|
||||
|
||||
var P = new Proxy(Target, {construct: null});
|
||||
var P = new Proxy(Target, {
|
||||
construct: null
|
||||
});
|
||||
var obj = Reflect.construct(P, [3, 4], NewTarget);
|
||||
assert.sameValue(obj.sum, 7, "`construct` trap is `null`");
|
||||
assert.sameValue(calls, 1, "target is called once");
|
||||
|
|
|
@ -16,10 +16,13 @@ features: [Reflect.construct]
|
|||
var calls = 0;
|
||||
|
||||
function NewTarget() {}
|
||||
|
||||
function Target(a, b) {
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {sum: a + b};
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {
|
||||
sum: a + b
|
||||
};
|
||||
}
|
||||
|
||||
var P = new Proxy(Target, {});
|
||||
|
|
|
@ -27,13 +27,18 @@ features: [Reflect.construct]
|
|||
var calls = 0;
|
||||
|
||||
function NewTarget() {}
|
||||
|
||||
function Target(a, b) {
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {sum: a + b};
|
||||
assert.sameValue(new.target, NewTarget);
|
||||
calls += 1;
|
||||
return {
|
||||
sum: a + b
|
||||
};
|
||||
}
|
||||
|
||||
var P = new Proxy(Target, {construct: undefined});
|
||||
var P = new Proxy(Target, {
|
||||
construct: undefined
|
||||
});
|
||||
var obj = Reflect.construct(P, [3, 4], NewTarget);
|
||||
assert.sameValue(obj.sum, 7, "`construct` trap is `undefined`");
|
||||
assert.sameValue(calls, 1, "target is called once");
|
||||
|
|
|
@ -16,5 +16,5 @@ var revocable = Proxy.revocable({}, {});
|
|||
revocable.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, revocable.proxy);
|
||||
new Proxy({}, revocable.proxy);
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, false);
|
||||
new Proxy({}, false);
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, null);
|
||||
new Proxy({}, null);
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, 0);
|
||||
new Proxy({}, 0);
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, "");
|
||||
new Proxy({}, "");
|
||||
});
|
||||
|
|
|
@ -11,5 +11,5 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, Symbol());
|
||||
new Proxy({}, Symbol());
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy({}, undefined);
|
||||
new Proxy({}, undefined);
|
||||
});
|
||||
|
|
|
@ -21,5 +21,5 @@ info: |
|
|||
var p = new Proxy({}, {});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.call();
|
||||
p.call();
|
||||
});
|
||||
|
|
|
@ -24,5 +24,5 @@ var p = new Proxy(eval, {});
|
|||
p(); // the Proxy object is callable
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new p();
|
||||
new p();
|
||||
});
|
||||
|
|
|
@ -16,5 +16,5 @@ var revocable = Proxy.revocable({}, {});
|
|||
revocable.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(revocable.proxy, {});
|
||||
new Proxy(revocable.proxy, {});
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(false, {});
|
||||
new Proxy(false, {});
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(null, {});
|
||||
new Proxy(null, {});
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(0, {});
|
||||
new Proxy(0, {});
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy("", {});
|
||||
new Proxy("", {});
|
||||
});
|
||||
|
|
|
@ -11,5 +11,5 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(Symbol(), {});
|
||||
new Proxy(Symbol(), {});
|
||||
});
|
||||
|
|
|
@ -10,5 +10,5 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Proxy(undefined, {});
|
||||
new Proxy(undefined, {});
|
||||
});
|
||||
|
|
|
@ -18,20 +18,20 @@ info: |
|
|||
var _handler, _target, _prop, _desc;
|
||||
var target = {};
|
||||
var descriptor = {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
};
|
||||
var handler = {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
_desc = desc;
|
||||
defineProperty: function(t, prop, desc) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
_desc = desc;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
@ -42,8 +42,8 @@ assert.sameValue(_target, target);
|
|||
assert.sameValue(_prop, "attr");
|
||||
|
||||
assert.sameValue(
|
||||
Object.keys(_desc).length, 4,
|
||||
"descriptor arg has the same amount of keys as given descriptor"
|
||||
Object.keys(_desc).length, 4,
|
||||
"descriptor arg has the same amount of keys as given descriptor"
|
||||
);
|
||||
|
||||
assert(_desc.configurable);
|
||||
|
|
|
@ -11,8 +11,8 @@ var p = Proxy.revocable({}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p.proxy, "foo", {
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(p.proxy, "foo", {
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,16 +12,16 @@ includes: [propertyHelper.js]
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return Object.defineProperty(t, prop, desc);
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return Object.defineProperty(t, prop, desc);
|
||||
}
|
||||
});
|
||||
|
||||
var result = Reflect.defineProperty(p, "attr", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(result, true, "result === true");
|
||||
|
@ -32,10 +32,10 @@ verifyEnumerable(target, "attr");
|
|||
verifyConfigurable(target, "attr");
|
||||
|
||||
result = Reflect.defineProperty(p, "attr", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: 2
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: 2
|
||||
});
|
||||
|
||||
assert.sameValue(result, true, "result === true");
|
||||
|
|
|
@ -15,11 +15,11 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
Object.defineProperty(p, "foo", {});
|
||||
Object.defineProperty(p, "foo", {});
|
||||
});
|
||||
|
|
|
@ -17,19 +17,19 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, "foo", {
|
||||
value: 1,
|
||||
configurable: true
|
||||
value: 1,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1,
|
||||
configurable: false
|
||||
});
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1,
|
||||
configurable: false
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,19 +17,19 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, "foo", {
|
||||
value: 1,
|
||||
configurable: false
|
||||
value: 1,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1,
|
||||
configurable: true
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,17 +17,17 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, "foo", {
|
||||
value: 1
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 2
|
||||
});
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 2
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,13 +17,13 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {
|
||||
configurable: false
|
||||
});
|
||||
Object.defineProperty(p, "foo", {
|
||||
configurable: false
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,13 +16,13 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.preventExtensions(target);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {});
|
||||
Object.defineProperty(p, "foo", {});
|
||||
});
|
||||
|
|
|
@ -19,11 +19,11 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: {}
|
||||
defineProperty: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1
|
||||
});
|
||||
Object.defineProperty(p, "foo", {
|
||||
value: 1
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,10 +18,10 @@ var target = {};
|
|||
var p = new Proxy(target, {});
|
||||
|
||||
Object.defineProperty(p, "attr", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
verifyEqualTo(target, "attr", 1);
|
||||
|
@ -30,10 +30,10 @@ verifyEnumerable(target, "attr");
|
|||
verifyConfigurable(target, "attr");
|
||||
|
||||
Object.defineProperty(p, "attr", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: 2
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: 2
|
||||
});
|
||||
|
||||
verifyEqualTo(target, "attr", 2);
|
||||
|
|
|
@ -15,13 +15,13 @@ features: [Reflect]
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return 0;
|
||||
}
|
||||
defineProperty: function(t, prop, desc) {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Reflect.defineProperty(p, "attr", {}), false);
|
||||
assert.sameValue(
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
);
|
||||
|
|
|
@ -11,20 +11,20 @@ features: [Reflect]
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
deleteProperty: function() {
|
||||
return 0;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperties(target, {
|
||||
isConfigurable: {
|
||||
value: 1,
|
||||
configurable: true
|
||||
},
|
||||
notConfigurable: {
|
||||
value: 1,
|
||||
configurable: false
|
||||
}
|
||||
isConfigurable: {
|
||||
value: 1,
|
||||
configurable: true
|
||||
},
|
||||
notConfigurable: {
|
||||
value: 1,
|
||||
configurable: false
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Reflect.deleteProperty(p, "attr"), false);
|
||||
|
|
|
@ -9,9 +9,9 @@ description: >
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: function() {
|
||||
return 1;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Reflect.deleteProperty(p, "attr"), true);
|
||||
|
|
|
@ -14,15 +14,15 @@ info: |
|
|||
|
||||
var _handler, _target, _prop;
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var handler = {
|
||||
deleteProperty: function(t, prop) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
return delete t[prop];
|
||||
}
|
||||
deleteProperty: function(t, prop) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
return delete t[prop];
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ description: >
|
|||
---*/
|
||||
|
||||
var p = Proxy.revocable({
|
||||
attr: 1
|
||||
attr: 1
|
||||
}, {});
|
||||
|
||||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete p.proxy.attr;
|
||||
delete p.proxy.attr;
|
||||
});
|
||||
|
|
|
@ -10,9 +10,9 @@ flags: [noStrict]
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: function() {
|
||||
return false;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(delete p.attr, false);
|
||||
|
|
|
@ -11,9 +11,9 @@ features: [Reflect]
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: function() {
|
||||
return false;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Reflect.deleteProperty(p, "attr"), false);
|
||||
|
|
|
@ -10,11 +10,11 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: function(t, prop) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
deleteProperty: function(t, prop) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
delete p.attr;
|
||||
delete p.attr;
|
||||
});
|
||||
|
|
|
@ -13,16 +13,16 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
deleteProperty: function() {
|
||||
return true;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, "attr", {
|
||||
configurable: false,
|
||||
value: 1
|
||||
configurable: false,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete p.attr;
|
||||
delete p.attr;
|
||||
});
|
||||
|
|
|
@ -9,9 +9,9 @@ description: >
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: function() {
|
||||
return true;
|
||||
}
|
||||
deleteProperty: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(delete p.attr, true);
|
||||
|
|
|
@ -16,9 +16,9 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
deleteProperty: {}
|
||||
deleteProperty: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete p.attr;
|
||||
delete p.attr;
|
||||
});
|
||||
|
|
|
@ -10,21 +10,21 @@ flags: [noStrict]
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {});
|
||||
|
||||
assert.sameValue(delete p.attr, true);
|
||||
assert.sameValue(delete p.notThere, true);
|
||||
assert.sameValue(
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
);
|
||||
|
||||
Object.defineProperty(target, "attr", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(delete p.attr, false);
|
||||
|
|
|
@ -11,21 +11,21 @@ features: [Reflect]
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {});
|
||||
|
||||
assert.sameValue(delete p.attr, true);
|
||||
assert.sameValue(delete p.notThere, true);
|
||||
assert.sameValue(
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
Object.getOwnPropertyDescriptor(target, "attr"),
|
||||
undefined
|
||||
);
|
||||
|
||||
Object.defineProperty(target, "attr", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(Reflect.deleteProperty(p, "attr"), false);
|
||||
|
|
|
@ -8,7 +8,7 @@ description: >
|
|||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(Proxy),
|
||||
Function.prototype,
|
||||
"`Object.getPrototypeOf(Proxy)` returns `Function.prototype`"
|
||||
Object.getPrototypeOf(Proxy),
|
||||
Function.prototype,
|
||||
"`Object.getPrototypeOf(Proxy)` returns `Function.prototype`"
|
||||
);
|
||||
|
|
|
@ -22,6 +22,8 @@ features: [cross-realm]
|
|||
var other = $262.createRealm().global;
|
||||
var C = new other.Function();
|
||||
// Ensure that the proxy does not report a `prototype` property
|
||||
var P = new Proxy(C, { get: function() {} });
|
||||
var P = new Proxy(C, {
|
||||
get: function() {}
|
||||
});
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(new P()), other.Object.prototype);
|
||||
|
|
|
@ -17,20 +17,20 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: false,
|
||||
get: undefined
|
||||
configurable: false,
|
||||
get: undefined
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.attr;
|
||||
p.attr;
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p['attr'];
|
||||
p['attr'];
|
||||
});
|
||||
|
|
|
@ -14,15 +14,15 @@ info: |
|
|||
|
||||
var _target, _handler, _prop, _receiver;
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var handler = {
|
||||
get: function(t, prop, receiver) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
_receiver = receiver;
|
||||
}
|
||||
get: function(t, prop, receiver) {
|
||||
_handler = this;
|
||||
_target = t;
|
||||
_prop = prop;
|
||||
_receiver = receiver;
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
@ -36,6 +36,6 @@ assert.sameValue(_receiver, p, "receiver is the Proxy object");
|
|||
_prop = null;
|
||||
p["attr"];
|
||||
assert.sameValue(
|
||||
_prop, "attr",
|
||||
"trap is triggered both by p.attr and p['attr']"
|
||||
_prop, "attr",
|
||||
"trap is triggered both by p.attr and p['attr']"
|
||||
);
|
||||
|
|
|
@ -17,21 +17,21 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: 1
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.attr;
|
||||
p.attr;
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p['attr'];
|
||||
p['attr'];
|
||||
});
|
||||
|
|
|
@ -13,9 +13,9 @@ var p = Proxy.revocable({}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.proxy.attr;
|
||||
p.proxy.attr;
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.proxy['attr'];
|
||||
p.proxy['attr'];
|
||||
});
|
||||
|
|
|
@ -12,15 +12,15 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
p.attr;
|
||||
p.attr;
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
p["attr"];
|
||||
p["attr"];
|
||||
});
|
||||
|
|
|
@ -10,15 +10,15 @@ description: >
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
get: function() {
|
||||
return 1;
|
||||
}
|
||||
get: function() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 2);
|
||||
|
|
|
@ -10,15 +10,15 @@ description: >
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: 1
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 2);
|
||||
|
|
|
@ -10,14 +10,14 @@ description: >
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: true,
|
||||
get: undefined
|
||||
configurable: true,
|
||||
get: undefined
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 2);
|
||||
|
|
|
@ -10,15 +10,15 @@ description: >
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: true,
|
||||
writable: false,
|
||||
value: 1
|
||||
configurable: true,
|
||||
writable: false,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 2);
|
||||
|
|
|
@ -19,15 +19,15 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 1;
|
||||
}
|
||||
get: function() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(target, 'attr', {
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: 1
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: 1
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 1);
|
||||
|
|
|
@ -9,12 +9,12 @@ description: >
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
get: function() {
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 2);
|
||||
|
|
|
@ -16,13 +16,13 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
get: {}
|
||||
get: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p.attr;
|
||||
p.attr;
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
p["attr"];
|
||||
p["attr"];
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ description: >
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {});
|
||||
|
||||
|
|
|
@ -13,12 +13,14 @@ info: |
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
get attr() {
|
||||
return this;
|
||||
}
|
||||
get attr() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
var p = new Proxy(target, { get: null });
|
||||
var p = new Proxy(target, {
|
||||
get: null
|
||||
});
|
||||
assert.sameValue(p.attr, p);
|
||||
|
||||
var pParent = Object.create(new Proxy(target, {}));
|
||||
|
|
|
@ -10,10 +10,10 @@ description: >
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {
|
||||
get: undefined
|
||||
get: undefined
|
||||
});
|
||||
|
||||
assert.sameValue(p.attr, 1, 'return target.attr');
|
||||
|
|
|
@ -13,15 +13,17 @@ info: |
|
|||
---*/
|
||||
|
||||
var _target, _handler, _prop;
|
||||
var target = {attr: 1};
|
||||
var target = {
|
||||
attr: 1
|
||||
};
|
||||
var handler = {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
_target = t;
|
||||
_handler = this;
|
||||
_prop = prop;
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
_target = t;
|
||||
_handler = this;
|
||||
_prop = prop;
|
||||
|
||||
return Object.getOwnPropertyDescriptor(t);
|
||||
}
|
||||
return Object.getOwnPropertyDescriptor(t);
|
||||
}
|
||||
};
|
||||
var p = new Proxy(target, handler);
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ var p = Proxy.revocable({}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p.proxy);
|
||||
Object.getOwnPropertyDescriptor(p.proxy);
|
||||
});
|
||||
|
|
|
@ -16,17 +16,17 @@ info: |
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
foo: 1
|
||||
foo: 1
|
||||
};
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Object.preventExtensions(target);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
});
|
||||
|
|
|
@ -17,17 +17,17 @@ info: |
|
|||
|
||||
var target = {};
|
||||
Object.defineProperty(target, "foo", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: 1
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: 1
|
||||
});
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
});
|
||||
|
|
|
@ -17,15 +17,15 @@ info: |
|
|||
var t = {};
|
||||
var trapped;
|
||||
var p = new Proxy(t, {
|
||||
getOwnPropertyDescriptor: function(target, prop) {
|
||||
trapped = true;
|
||||
return;
|
||||
}
|
||||
getOwnPropertyDescriptor: function(target, prop) {
|
||||
trapped = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(
|
||||
Object.getOwnPropertyDescriptor(p, "attr"),
|
||||
undefined
|
||||
Object.getOwnPropertyDescriptor(p, "attr"),
|
||||
undefined
|
||||
);
|
||||
|
||||
assert(trapped);
|
||||
|
|
|
@ -16,13 +16,13 @@ info: |
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
attr: 1
|
||||
attr: 1
|
||||
};
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Object.getOwnPropertyDescriptor(p, "attr"), undefined);
|
||||
|
|
|
@ -16,7 +16,9 @@ features: [cross-realm]
|
|||
var OProxy = $262.createRealm().global.Proxy;
|
||||
|
||||
var p = new OProxy({}, {
|
||||
getOwnPropertyDescriptor: function() { return null; }
|
||||
getOwnPropertyDescriptor: function() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
|
|
|
@ -15,34 +15,34 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
number: 1,
|
||||
symbol: Symbol(),
|
||||
string: '',
|
||||
boolean: true,
|
||||
fn: function() {}
|
||||
number: 1,
|
||||
symbol: Symbol(),
|
||||
string: '',
|
||||
boolean: true,
|
||||
fn: function() {}
|
||||
};
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return t[prop];
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return t[prop];
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "number");
|
||||
Object.getOwnPropertyDescriptor(p, "number");
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "string");
|
||||
Object.getOwnPropertyDescriptor(p, "string");
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "symbol");
|
||||
Object.getOwnPropertyDescriptor(p, "symbol");
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "boolean");
|
||||
Object.getOwnPropertyDescriptor(p, "boolean");
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "fn");
|
||||
Object.getOwnPropertyDescriptor(p, "fn");
|
||||
});
|
||||
|
|
|
@ -17,15 +17,17 @@ info: |
|
|||
var target = {};
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = { bar: 1 };
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = {
|
||||
bar: 1
|
||||
};
|
||||
|
||||
return Object.getOwnPropertyDescriptor(foo, "bar");
|
||||
}
|
||||
return Object.getOwnPropertyDescriptor(foo, "bar");
|
||||
}
|
||||
});
|
||||
|
||||
Object.preventExtensions(target);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
});
|
||||
|
|
|
@ -17,23 +17,23 @@ info: |
|
|||
---*/
|
||||
|
||||
var target = {
|
||||
bar: 1
|
||||
bar: 1
|
||||
};
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = {};
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = {};
|
||||
|
||||
Object.defineProperty(foo, "bar", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
Object.defineProperty(foo, "bar", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
return Object.getOwnPropertyDescriptor(foo, prop);
|
||||
}
|
||||
return Object.getOwnPropertyDescriptor(foo, prop);
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
});
|
||||
|
|
|
@ -29,19 +29,19 @@ info: |
|
|||
var target = {};
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = {};
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
var foo = {};
|
||||
|
||||
Object.defineProperty(foo, "bar", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
Object.defineProperty(foo, "bar", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
return Object.getOwnPropertyDescriptor(foo, prop);
|
||||
}
|
||||
return Object.getOwnPropertyDescriptor(foo, prop);
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
Object.getOwnPropertyDescriptor(p, "bar");
|
||||
});
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
|
||||
var target = {};
|
||||
var descriptor = {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
};
|
||||
|
||||
Object.defineProperty(target, "bar", descriptor);
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return Object.getOwnPropertyDescriptor(t, prop);
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return Object.getOwnPropertyDescriptor(t, prop);
|
||||
}
|
||||
});
|
||||
|
||||
var proxyDesc = Object.getOwnPropertyDescriptor(p, "bar");
|
||||
|
|
|
@ -10,15 +10,15 @@ description: >
|
|||
var target = {};
|
||||
|
||||
Object.defineProperty(target, "attr", {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 1
|
||||
});
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return Object.getOwnPropertyDescriptor(t, prop);
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
return Object.getOwnPropertyDescriptor(t, prop);
|
||||
}
|
||||
});
|
||||
|
||||
var proxyDesc = Object.getOwnPropertyDescriptor(p, "attr");
|
||||
|
|
|
@ -14,11 +14,11 @@ info: |
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
getOwnPropertyDescriptor: function(t, prop) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "attr");
|
||||
Object.getOwnPropertyDescriptor(p, "attr");
|
||||
});
|
||||
|
|
|
@ -22,9 +22,9 @@ info: |
|
|||
|
||||
var target = {};
|
||||
var p = new Proxy(target, {
|
||||
getOwnPropertyDescriptor: {}
|
||||
getOwnPropertyDescriptor: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
Object.getOwnPropertyDescriptor(p, "foo");
|
||||
});
|
||||
|
|
|
@ -14,7 +14,9 @@ info: |
|
|||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var target = {attr: 1};
|
||||
var target = {
|
||||
attr: 1
|
||||
};
|
||||
var p = new Proxy(target, {});
|
||||
|
||||
var proxyDesc = Object.getOwnPropertyDescriptor(p, "attr");
|
||||
|
|
|
@ -22,7 +22,9 @@ info: |
|
|||
|
||||
---*/
|
||||
|
||||
var prot = { foo: 1 };
|
||||
var prot = {
|
||||
foo: 1
|
||||
};
|
||||
var p = new Proxy({}, {
|
||||
getPrototypeOf: function() {
|
||||
return prot;
|
||||
|
|
|
@ -25,7 +25,9 @@ info: |
|
|||
...
|
||||
---*/
|
||||
|
||||
var target = Object.create({ foo: 1 });
|
||||
var target = Object.create({
|
||||
foo: 1
|
||||
});
|
||||
|
||||
var p = new Proxy(target, {
|
||||
getPrototypeOf: function() {
|
||||
|
@ -36,5 +38,5 @@ var p = new Proxy(target, {
|
|||
Object.preventExtensions(target);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getPrototypeOf(p);
|
||||
Object.getPrototypeOf(p);
|
||||
});
|
||||
|
|
|
@ -11,5 +11,5 @@ var p = Proxy.revocable({}, {});
|
|||
p.revoke();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getPrototypeOf(p.proxy);
|
||||
Object.getPrototypeOf(p.proxy);
|
||||
});
|
||||
|
|
|
@ -16,5 +16,5 @@ var p = new Proxy({}, {
|
|||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
Object.getPrototypeOf(p);
|
||||
Object.getPrototypeOf(p);
|
||||
});
|
||||
|
|
|
@ -7,9 +7,9 @@ description: >
|
|||
---*/
|
||||
|
||||
var p = new Proxy({}, {
|
||||
getPrototypeOf: {}
|
||||
getPrototypeOf: {}
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.getPrototypeOf(p);
|
||||
Object.getPrototypeOf(p);
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue