mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
Sort out __proto__ occurances outside of annexB
This commit is contained in:
parent
e1fb459313
commit
a799a4ac23
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2019 Ron Buckton. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: The groups object of indices is created with CreateDataProperty
|
||||||
|
includes: [compareArray.js, propertyHelper.js]
|
||||||
|
esid: sec-makeindicesarray
|
||||||
|
features: [regexp-named-groups, regexp-match-indices]
|
||||||
|
info: |
|
||||||
|
MakeIndicesArray ( S, indices, groupNames )
|
||||||
|
8. If _groupNames_ is not *undefined*, then
|
||||||
|
a. Let _groups_ be ! ObjectCreate(*null*).
|
||||||
|
9. Else,
|
||||||
|
a. Let _groups_ be *undefined*.
|
||||||
|
10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The `__proto__` property on the groups object is not special,
|
||||||
|
// and does not affect the [[Prototype]] of the resulting groups object.
|
||||||
|
let {groups} = /(?<__proto__>.)/.exec("a").indices;
|
||||||
|
assert.compareArray([0, 1], groups.__proto__);
|
||||||
|
assert.sameValue(null, Object.getPrototypeOf(groups));
|
22
test/annexB/built-ins/RegExp/named-groups/groups-object.js
Normal file
22
test/annexB/built-ins/RegExp/named-groups/groups-object.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2017 Aleksey Shvayka. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Properties of the groups object are created with CreateDataProperty
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
esid: sec-regexpbuiltinexec
|
||||||
|
features: [regexp-named-groups]
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: RegExpBuiltinExec ( R, S )
|
||||||
|
24. If _R_ contains any |GroupName|, then
|
||||||
|
a. Let _groups_ be ObjectCreate(*null*).
|
||||||
|
25. Else,
|
||||||
|
a. Let _groups_ be *undefined*.
|
||||||
|
26. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The `__proto__` property on the groups object is not special,
|
||||||
|
// and does not affect the [[Prototype]] of the resulting groups object.
|
||||||
|
let {groups} = /(?<__proto__>.)/.exec("a");
|
||||||
|
assert.sameValue("a", groups.__proto__);
|
||||||
|
assert.sameValue(null, Object.getPrototypeOf(groups));
|
@ -29,4 +29,3 @@ var functionTarget = new Proxy(function(_arg) {}, {});
|
|||||||
var functionProxy = new Proxy(functionTarget, {});
|
var functionProxy = new Proxy(functionTarget, {});
|
||||||
|
|
||||||
assert.sameValue(Object.create(functionProxy).length, 1);
|
assert.sameValue(Object.create(functionProxy).length, 1);
|
||||||
assert.sameValue(functionProxy.__proto__, Function.prototype);
|
|
||||||
|
@ -29,5 +29,5 @@ assert("lastIndex" in Object.create(regExpProxy));
|
|||||||
var functionTarget = new Proxy(function() {}, {});
|
var functionTarget = new Proxy(function() {}, {});
|
||||||
var functionProxy = new Proxy(functionTarget, {});
|
var functionProxy = new Proxy(functionTarget, {});
|
||||||
|
|
||||||
assert("__proto__" in functionProxy);
|
assert("name" in functionProxy);
|
||||||
assert("length" in Object.create(functionProxy));
|
assert("length" in Object.create(functionProxy));
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
|
|
||||||
description: >
|
|
||||||
Ordinary [[Set]] forwards call to Proxy "set" trap with correct arguments.
|
|
||||||
Property name is "__proto__".
|
|
||||||
info: |
|
|
||||||
OrdinarySet ( O, P, V, Receiver )
|
|
||||||
|
|
||||||
...
|
|
||||||
3. Return OrdinarySetWithOwnDescriptor(O, P, V, Receiver, ownDesc).
|
|
||||||
|
|
||||||
OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
|
|
||||||
|
|
||||||
...
|
|
||||||
2. If ownDesc is undefined, then
|
|
||||||
a. Let parent be ? O.[[GetPrototypeOf]]().
|
|
||||||
b. If parent is not null, then
|
|
||||||
i. Return ? parent.[[Set]](P, V, Receiver).
|
|
||||||
|
|
||||||
[[Set]] ( P, V, Receiver )
|
|
||||||
|
|
||||||
...
|
|
||||||
8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)).
|
|
||||||
...
|
|
||||||
12. Return true.
|
|
||||||
includes: [proxyTrapsHelper.js]
|
|
||||||
features: [Proxy]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var _handler, _target, _prop, _value, _receiver;
|
|
||||||
var target = {};
|
|
||||||
var handler = allowProxyTraps({
|
|
||||||
set: function(target, prop, value, receiver) {
|
|
||||||
_handler = this;
|
|
||||||
_target = target;
|
|
||||||
_prop = prop;
|
|
||||||
_value = value;
|
|
||||||
_receiver = receiver;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
var proxy = new Proxy(target, handler);
|
|
||||||
var receiver = Object.create(proxy);
|
|
||||||
var prop = '__proto__';
|
|
||||||
var value = {};
|
|
||||||
|
|
||||||
receiver[prop] = value;
|
|
||||||
|
|
||||||
assert.sameValue(_handler, handler, 'handler object is the trap context');
|
|
||||||
assert.sameValue(_target, target, 'first argument is the target object');
|
|
||||||
assert.sameValue(_prop, prop, 'second argument is the property name');
|
|
||||||
assert.sameValue(_value, value, 'third argument is the new value');
|
|
||||||
assert.sameValue(_receiver, receiver, 'fourth argument is the receiver object');
|
|
@ -45,6 +45,3 @@ assert(!Reflect.set(regExpProxy, "global", true));
|
|||||||
|
|
||||||
regExpProxy.lastIndex = 1;
|
regExpProxy.lastIndex = 1;
|
||||||
assert.sameValue(regExp.lastIndex, 1);
|
assert.sameValue(regExp.lastIndex, 1);
|
||||||
|
|
||||||
regExpProxy.__proto__ = null;
|
|
||||||
assert.sameValue(Object.getPrototypeOf(regExp), null);
|
|
||||||
|
@ -32,9 +32,3 @@ verifyProperty(indices, 'groups', {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// The `__proto__` property on the groups object is not special,
|
|
||||||
// and does not affect the [[Prototype]] of the resulting groups object.
|
|
||||||
let {groups} = /(?<__proto__>.)/.exec("a").indices;
|
|
||||||
assert.compareArray([0, 1], groups.__proto__);
|
|
||||||
assert.sameValue(null, Object.getPrototypeOf(groups));
|
|
||||||
|
@ -31,9 +31,3 @@ verifyProperty(match, "groups", {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// The `__proto__` property on the groups object is not special,
|
|
||||||
// and does not affect the [[Prototype]] of the resulting groups object.
|
|
||||||
let {groups} = /(?<__proto__>.)/.exec("a");
|
|
||||||
assert.sameValue("a", groups.__proto__);
|
|
||||||
assert.sameValue(null, Object.getPrototypeOf(groups));
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user