From 323905b70e644d90faa957235f8ac59eac4ba8ba Mon Sep 17 00:00:00 2001 From: Alexey Shvayka Date: Wed, 9 Sep 2020 22:59:23 +0300 Subject: [PATCH] Improve RegExp.prototype[@@replace] poisoned stdlib test --- .../prototype/Symbol.replace/poisoned-stdlib.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js b/test/built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js index 4df9d5ed9d..57bb02f865 100644 --- a/test/built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js +++ b/test/built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js @@ -17,6 +17,17 @@ assert(delete String.prototype.indexOf); assert(delete String.prototype.slice); assert(delete String.prototype.substring); +for (let i = 0; i < 5; ++i) { + Object.defineProperty(Array.prototype, i, { + get: function() { + throw new Test262Error(i + " getter should be unreachable."); + }, + set: function(_value) { + throw new Test262Error(i + " setter should be unreachable."); + }, + }); +} + var str = "1a2"; assert.sameValue(/a/[Symbol.replace](str, "$`b"), "11b2");