зеркало из https://github.com/mozilla/gecko-dev.git
Bug 830783 - Part a: Pass MutableHandleValue to DoMatch in jsstr.cpp; r=terrence
This commit is contained in:
Родитель
354efa4550
Коммит
bbf192f4d7
|
@ -1716,7 +1716,7 @@ enum MatchControlFlags {
|
||||||
/* Factor out looping and matching logic. */
|
/* Factor out looping and matching logic. */
|
||||||
static bool
|
static bool
|
||||||
DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||||
DoMatchCallback callback, void *data, MatchControlFlags flags, Value *rval)
|
DoMatchCallback callback, void *data, MatchControlFlags flags, MutableHandleValue rval)
|
||||||
{
|
{
|
||||||
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
|
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
|
||||||
if (!stableStr)
|
if (!stableStr)
|
||||||
|
@ -1738,12 +1738,12 @@ DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (status == RegExpRunStatus_Success_NotFound) {
|
if (status == RegExpRunStatus_Success_NotFound) {
|
||||||
rval->setNull();
|
rval.setNull();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
res->updateFromMatchPairs(cx, stableStr, matches);
|
res->updateFromMatchPairs(cx, stableStr, matches);
|
||||||
if (!isTest && !CreateRegExpMatchResult(cx, stableStr, matches, rval))
|
if (!isTest && !CreateRegExpMatchResult(cx, stableStr, matches, rval.address()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!callback(cx, res, count, data))
|
if (!callback(cx, res, count, data))
|
||||||
|
@ -1762,16 +1762,16 @@ DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||||
|
|
||||||
/* Emulate ExecuteRegExpLegacy() behavior. */
|
/* Emulate ExecuteRegExpLegacy() behavior. */
|
||||||
if (status == RegExpRunStatus_Success_NotFound) {
|
if (status == RegExpRunStatus_Success_NotFound) {
|
||||||
rval->setNull();
|
rval.setNull();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
res->updateFromMatchPairs(cx, stableStr, matches);
|
res->updateFromMatchPairs(cx, stableStr, matches);
|
||||||
|
|
||||||
if (isTest) {
|
if (isTest) {
|
||||||
rval->setBoolean(true);
|
rval.setBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
if (!CreateRegExpMatchResult(cx, stableStr, matches, rval))
|
if (!CreateRegExpMatchResult(cx, stableStr, matches, rval.address()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1858,7 +1858,7 @@ js::str_match(JSContext *cx, unsigned argc, Value *vp)
|
||||||
MatchArgType arg = array.address();
|
MatchArgType arg = array.address();
|
||||||
RegExpStatics *res = cx->regExpStatics();
|
RegExpStatics *res = cx->regExpStatics();
|
||||||
RootedValue rval(cx);
|
RootedValue rval(cx);
|
||||||
if (!DoMatch(cx, res, str, g.regExp(), MatchCallback, arg, MATCH_ARGS, rval.address()))
|
if (!DoMatch(cx, res, str, g.regExp(), MatchCallback, arg, MATCH_ARGS, &rval))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g.regExp().global())
|
if (g.regExp().global())
|
||||||
|
@ -2482,7 +2482,7 @@ str_replace_regexp(JSContext *cx, CallArgs args, ReplaceData &rdata)
|
||||||
return str_replace_regexp_remove(cx, args, rdata.str, re);
|
return str_replace_regexp_remove(cx, args, rdata.str, re);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value tmp;
|
RootedValue tmp(cx);
|
||||||
if (!DoMatch(cx, res, rdata.str, re, ReplaceRegExpCallback, &rdata, REPLACE_ARGS, &tmp))
|
if (!DoMatch(cx, res, rdata.str, re, ReplaceRegExpCallback, &rdata, REPLACE_ARGS, &tmp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче