From 8b506020992ade0bfc6b29591f76cc2622d9a722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 17 Jan 2018 10:39:16 -0800 Subject: [PATCH] Replace Annex-B __proto__ with Object.[gs]etPrototypeOf --- .../RegExp/named-groups/groups-object-subclass-sans.js | 4 ++-- test/built-ins/RegExp/named-groups/groups-object-subclass.js | 4 ++-- test/built-ins/RegExp/named-groups/groups-object-undefined.js | 2 +- test/built-ins/RegExp/named-groups/groups-object-unmatched.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/built-ins/RegExp/named-groups/groups-object-subclass-sans.js b/test/built-ins/RegExp/named-groups/groups-object-subclass-sans.js index 58a1458d81..7a69b281d8 100644 --- a/test/built-ins/RegExp/named-groups/groups-object-subclass-sans.js +++ b/test/built-ins/RegExp/named-groups/groups-object-subclass-sans.js @@ -27,11 +27,11 @@ class FakeRegExp extends RegExp { const re = new FakeRegExp(); const result = re.exec("ab"); -assert.sameValue(result.__proto__, Array.prototype); +assert.sameValue(Object.getPrototypeOf(result), Array.prototype); assert.sameValue(false, result.hasOwnProperty("groups")); Array.prototype.groups = { a: "b" }; -Array.prototype.groups.__proto__.b = "c"; +Object.getPrototypeOf(Array.prototype.groups).b = "c"; assert.sameValue("b", "ab".replace(re, "$")); assert.sameValue("c", "ab".replace(re, "$")); Array.prototype.groups = undefined; diff --git a/test/built-ins/RegExp/named-groups/groups-object-subclass.js b/test/built-ins/RegExp/named-groups/groups-object-subclass.js index af5d02f28c..968e7c153e 100644 --- a/test/built-ins/RegExp/named-groups/groups-object-subclass.js +++ b/test/built-ins/RegExp/named-groups/groups-object-subclass.js @@ -21,14 +21,14 @@ class FakeRegExp extends RegExp { const fakeResult = ["ab", "a"]; fakeResult.index = 0; fakeResult.groups = { a: "b" }; - fakeResult.groups.__proto__.b = "c"; + Object.getPrototypeOf(fakeResult.groups).b = "c"; return fakeResult; } }; const re = new FakeRegExp(); const result = re.exec("ab"); -assert.sameValue(result.__proto__, Array.prototype); +assert.sameValue(Object.getPrototypeOf(result), Array.prototype); assert(result.hasOwnProperty("groups")); assert.sameValue("b", result.groups.a); assert.sameValue("b", "ab".replace(re, "$")); diff --git a/test/built-ins/RegExp/named-groups/groups-object-undefined.js b/test/built-ins/RegExp/named-groups/groups-object-undefined.js index 76a8fa5e68..fea8fd0bfa 100644 --- a/test/built-ins/RegExp/named-groups/groups-object-undefined.js +++ b/test/built-ins/RegExp/named-groups/groups-object-undefined.js @@ -17,7 +17,7 @@ info: | const re = /./; const result = re.exec("a"); -assert.sameValue(result.__proto__, Array.prototype); +assert.sameValue(Object.getPrototypeOf(result), Array.prototype); assert(result.hasOwnProperty("groups")); assert.sameValue("a", result[0]); assert.sameValue(0, result.index); diff --git a/test/built-ins/RegExp/named-groups/groups-object-unmatched.js b/test/built-ins/RegExp/named-groups/groups-object-unmatched.js index 610d205e81..2c7dc53c3b 100644 --- a/test/built-ins/RegExp/named-groups/groups-object-unmatched.js +++ b/test/built-ins/RegExp/named-groups/groups-object-unmatched.js @@ -18,7 +18,7 @@ info: | const re = /(?a).|(?x)/; const result = re.exec("ab"); -assert.sameValue(result.__proto__, Array.prototype); +assert.sameValue(Object.getPrototypeOf(result), Array.prototype); assert(result.hasOwnProperty("groups")); assert.sameValue("ab", result[0]); assert.sameValue("a", result[1]);