mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 501739 - Make String.prototype.match use the zero-lastIndex helper method added in the previous revision. r=trivial
--HG-- extra : rebase_source : 798fb3265e1a2a3213458e7d46c619c49c1c8b5c
This commit is contained in:
parent
d57591aa8f
commit
b0d8176319
@ -1876,14 +1876,8 @@ DoMatchGlobal(JSContext *cx, CallArgs args, RegExpStatics *res, Handle<JSLinearS
|
||||
//
|
||||
// In short: it's okay to cheat (by setting .lastIndex to 0, once) because
|
||||
// we can't get caught.
|
||||
if (g.regExpIsObject()) {
|
||||
// Don't use RegExpObject::setLastIndex, because that ignores the
|
||||
// writability of "lastIndex" on this user-controlled RegExp object.
|
||||
RootedValue zero(cx, Int32Value(0));
|
||||
HandleObject regex = g.regExpObject();
|
||||
if (!JSObject::setProperty(cx, regex, regex, cx->names().lastIndex, &zero, true))
|
||||
return false;
|
||||
}
|
||||
if (!g.zeroLastIndex(cx))
|
||||
return false;
|
||||
|
||||
// Step 8b.
|
||||
AutoValueVector elements(cx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user