Skip to content

Commit

Permalink
Improve RegExp.prototype[@@replace] poisoned stdlib test
Browse files Browse the repository at this point in the history
  • Loading branch information
shvaikalesh authored and rwaldron committed Sep 10, 2020
1 parent d10446a commit 323905b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 323905b

Please sign in to comment.