UNCONFIRMED 103825
[ES5.1 - 15.10.6.2] RegExp.prototype.exec(string), step 5 "ToInteger(lastIndex)" not always executed
https://bugs.webkit.org/show_bug.cgi?id=103825
Summary [ES5.1 - 15.10.6.2] RegExp.prototype.exec(string), step 5 "ToInteger(lastInde...
André Bargull
Reported 2012-12-01 17:37:29 PST
Step 5 of [ES5.1 - 15.10.6.2] RegExp.prototype.exec(string) must always be executed due to side effects. This affects not only plain calls to RegExp.prototype.exec, but also RegExp.prototype.test, String.prototype.match and String.prototype.replace, because these functions call directly or indirectly RegExp.prototype.exec. List of different javascript engines/browsers and the result for each test: --- r = /a/; r.lastIndex = {valueOf: function(){throw "err"}}; r.exec("zzzz"); Bad: JSC, IE Good: V8, SM, Opera r = /a/; r.lastIndex = {valueOf: function(){throw "err"}}; r.test("zzzz"); Bad: JSC, IE, Opera Good: V8, SM r = /a/; r.lastIndex = {valueOf: function(){throw "err"}}; "zzzz".match(r); Bad: JSC, IE, V8, SM Good: Opera r = /a/; r.lastIndex = {valueOf: function(){throw "err"}}; "zzzz".replace(r, ""); Bad: JSC, IE, V8, SM, Opera Good: - ---
Attachments
Note You need to log in before you can comment on or make changes to this bug.