Closed Bug 1343369 Opened 7 years ago Closed 7 years ago

RegExp.prototype[@@replace] needs to call ToLength(lastIndex) for non-global regexp opt

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1343375
Tracking Status
firefox54 --- affected

People

(Reporter: anba, Unassigned)

Details

Test case:
---
var r = /a/;
r.lastIndex = {
    valueOf() {
        print("HI");
        return 0;
    }
};
r[Symbol.replace]("");
---

Expected: Prints "HI"
Actual: Doesn't print "HI"
Will fix as part of bug 1343375.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.