From a799a4ac23a466950158f940a977968a743f3059 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 12 Apr 2020 09:00:00 -0500 Subject: [PATCH] Sort out __proto__ occurances outside of annexB --- .../built-ins/JSON/parse/S15.12.2_A1.js | 0 .../match-indices/indices-groups-object.js | 22 ++++++++ .../RegExp/named-groups/groups-object.js | 22 ++++++++ .../get/trap-is-missing-target-is-proxy.js | 1 - .../has/trap-is-missing-target-is-proxy.js | 2 +- .../call-parameters-prototype-dunder-proto.js | 56 ------------------- .../set/trap-is-missing-target-is-proxy.js | 3 - .../match-indices/indices-groups-object.js | 6 -- .../RegExp/named-groups/groups-object.js | 6 -- 9 files changed, 45 insertions(+), 73 deletions(-) rename test/{ => annexB}/built-ins/JSON/parse/S15.12.2_A1.js (100%) create mode 100644 test/annexB/built-ins/RegExp/match-indices/indices-groups-object.js create mode 100644 test/annexB/built-ins/RegExp/named-groups/groups-object.js delete mode 100644 test/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js diff --git a/test/built-ins/JSON/parse/S15.12.2_A1.js b/test/annexB/built-ins/JSON/parse/S15.12.2_A1.js similarity index 100% rename from test/built-ins/JSON/parse/S15.12.2_A1.js rename to test/annexB/built-ins/JSON/parse/S15.12.2_A1.js diff --git a/test/annexB/built-ins/RegExp/match-indices/indices-groups-object.js b/test/annexB/built-ins/RegExp/match-indices/indices-groups-object.js new file mode 100644 index 0000000000..6e64951428 --- /dev/null +++ b/test/annexB/built-ins/RegExp/match-indices/indices-groups-object.js @@ -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)); diff --git a/test/annexB/built-ins/RegExp/named-groups/groups-object.js b/test/annexB/built-ins/RegExp/named-groups/groups-object.js new file mode 100644 index 0000000000..acd68c8712 --- /dev/null +++ b/test/annexB/built-ins/RegExp/named-groups/groups-object.js @@ -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)); diff --git a/test/built-ins/Proxy/get/trap-is-missing-target-is-proxy.js b/test/built-ins/Proxy/get/trap-is-missing-target-is-proxy.js index c7d8b737f8..1bd3d22dae 100644 --- a/test/built-ins/Proxy/get/trap-is-missing-target-is-proxy.js +++ b/test/built-ins/Proxy/get/trap-is-missing-target-is-proxy.js @@ -29,4 +29,3 @@ var functionTarget = new Proxy(function(_arg) {}, {}); var functionProxy = new Proxy(functionTarget, {}); assert.sameValue(Object.create(functionProxy).length, 1); -assert.sameValue(functionProxy.__proto__, Function.prototype); diff --git a/test/built-ins/Proxy/has/trap-is-missing-target-is-proxy.js b/test/built-ins/Proxy/has/trap-is-missing-target-is-proxy.js index 1ca4a69390..c8a0f8941b 100644 --- a/test/built-ins/Proxy/has/trap-is-missing-target-is-proxy.js +++ b/test/built-ins/Proxy/has/trap-is-missing-target-is-proxy.js @@ -29,5 +29,5 @@ assert("lastIndex" in Object.create(regExpProxy)); var functionTarget = new Proxy(function() {}, {}); var functionProxy = new Proxy(functionTarget, {}); -assert("__proto__" in functionProxy); +assert("name" in functionProxy); assert("length" in Object.create(functionProxy)); diff --git a/test/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js b/test/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js deleted file mode 100644 index 5f0fbbd69c..0000000000 --- a/test/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js +++ /dev/null @@ -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'); diff --git a/test/built-ins/Proxy/set/trap-is-missing-target-is-proxy.js b/test/built-ins/Proxy/set/trap-is-missing-target-is-proxy.js index 655f2a37cb..b1d0b76f4c 100644 --- a/test/built-ins/Proxy/set/trap-is-missing-target-is-proxy.js +++ b/test/built-ins/Proxy/set/trap-is-missing-target-is-proxy.js @@ -45,6 +45,3 @@ assert(!Reflect.set(regExpProxy, "global", true)); regExpProxy.lastIndex = 1; assert.sameValue(regExp.lastIndex, 1); - -regExpProxy.__proto__ = null; -assert.sameValue(Object.getPrototypeOf(regExp), null); diff --git a/test/built-ins/RegExp/match-indices/indices-groups-object.js b/test/built-ins/RegExp/match-indices/indices-groups-object.js index 5d02e1de90..dc4a603d9c 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-object.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-object.js @@ -32,9 +32,3 @@ verifyProperty(indices, 'groups', { enumerable: 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)); diff --git a/test/built-ins/RegExp/named-groups/groups-object.js b/test/built-ins/RegExp/named-groups/groups-object.js index 32a85bf759..d8ee4aff7d 100644 --- a/test/built-ins/RegExp/named-groups/groups-object.js +++ b/test/built-ins/RegExp/named-groups/groups-object.js @@ -31,9 +31,3 @@ verifyProperty(match, "groups", { enumerable: 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));