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:
Jeff Walden 2013-09-20 11:53:14 -07:00
parent e2e0407533
commit 50a5c924c8

View File

@ -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);