archives

« Bugzilla Issues Index

#3424 — 21.1.3.* String.prototype.{match, replace, search, split}: matcher/replacer/searcher/splitter searched on the wrong object


21.1.3.11 String.prototype.match, step 4
21.1.3.14 String.prototype.replace, step 4
21.1.3.15 String.prototype.search, step 4
21.1.3.17 String.prototype.split, step 3

The matcher/replacer/searcher/splitter is tentatively fetched on object O. It should be fetched on regexp.


Oups, not always...

String.prototype.match, step 4: The matcher should be fetched on `regexp`.

String.prototype.replace, step 4: The replacer should be fetched on `searchValue`.

String.prototype.search, step 4: The searcher should be fetched on `regexp`.

String.prototype.split, step 3: The splitter should be fetched on `separator`.


fixed in rev30 editor's draft

here is what match now looks like:

1. Let O be RequireObjectCoercible(this value).
2. Let S be ToString(O).
3. ReturnIfAbrupt(S).
4. Let matcher be GetMethod(regexp, @@match).
5. ReturnIfAbrupt(matcher).
6. If matcher is not undefined, then
a. Return Call(matcher, regexp, «S»).
7. Let rx be RegExpCreate(regexp, undefined) (see .2.3.3).
8. Return Invoke(rx, @@match, «S»).


fixed in rev30