зеркало из https://github.com/mozilla/gecko-dev.git
Bug 879079 - Make ToNumber take a Handle to fix some static rooting analysis failures; r=sfink
--HG-- extra : rebase_source : 048d46820baedeb593f85e0d445375d482d16050
This commit is contained in:
Родитель
30b27916e4
Коммит
ebc01dfda0
|
@ -73,7 +73,7 @@ FoldType(JSContext *cx, ParseNode *pn, ParseNodeKind kind)
|
|||
case PNK_NUMBER:
|
||||
if (pn->isKind(PNK_STRING)) {
|
||||
double d;
|
||||
if (!ToNumber(cx, StringValue(pn->pn_atom), &d))
|
||||
if (!StringToNumber(cx, pn->pn_atom, &d))
|
||||
return false;
|
||||
pn->pn_dval = d;
|
||||
pn->setKind(PNK_NUMBER);
|
||||
|
|
|
@ -5565,12 +5565,12 @@ ValueToInt32(JSContext *cx, Value *val)
|
|||
}
|
||||
|
||||
static int32_t
|
||||
ValueToNumber(JSContext *cx, Value *val)
|
||||
ValueToNumber(JSContext *cx, MutableHandleValue val)
|
||||
{
|
||||
double dbl;
|
||||
if (!ToNumber(cx, val[0], &dbl))
|
||||
if (!ToNumber(cx, val, &dbl))
|
||||
return false;
|
||||
val[0] = DoubleValue(dbl);
|
||||
val.set(DoubleValue(dbl));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -656,7 +656,8 @@ IonBuilder::inlineMathPow(CallInfo &callInfo)
|
|||
// Optimize some constant powers.
|
||||
if (callInfo.getArg(1)->isConstant()) {
|
||||
double pow;
|
||||
if (!ToNumber(GetIonContext()->cx, callInfo.getArg(1)->toConstant()->value(), &pow))
|
||||
RootedValue v(GetIonContext()->cx, callInfo.getArg(1)->toConstant()->value());
|
||||
if (!ToNumber(GetIonContext()->cx, v, &pow))
|
||||
return InliningStatus_Error;
|
||||
|
||||
// Math.pow(x, 0.5) is a sqrt with edge-case detection.
|
||||
|
|
|
@ -1515,7 +1515,7 @@ namespace JS {
|
|||
|
||||
/* ES5 9.3 ToNumber. */
|
||||
JS_ALWAYS_INLINE bool
|
||||
ToNumber(JSContext *cx, const Value &v, double *out)
|
||||
ToNumber(JSContext *cx, HandleValue v, double *out)
|
||||
{
|
||||
AssertArgumentsAreSane(cx, v);
|
||||
{
|
||||
|
|
|
@ -1676,7 +1676,7 @@ SortNumerically(JSContext *cx, AutoValueVector *vec, size_t len, ComparatorMatch
|
|||
return false;
|
||||
|
||||
double dv;
|
||||
if (!ToNumber(cx, (*vec)[i], &dv))
|
||||
if (!ToNumber(cx, vec->handleAt(i), &dv))
|
||||
return false;
|
||||
|
||||
NumericElement el = { dv, i };
|
||||
|
|
|
@ -614,7 +614,7 @@ date_msecFromArgs(JSContext *cx, CallArgs args, double *rval)
|
|||
for (loop = 0; loop < MAXARGS; loop++) {
|
||||
if (loop < args.length()) {
|
||||
double d;
|
||||
if (!ToNumber(cx, args[loop], &d))
|
||||
if (!ToNumber(cx, args.handleAt(loop), &d))
|
||||
return JS_FALSE;
|
||||
/* return NaN if any arg is not finite */
|
||||
if (!IsFinite(d)) {
|
||||
|
@ -1714,7 +1714,7 @@ date_setTime_impl(JSContext *cx, CallArgs args)
|
|||
}
|
||||
|
||||
double result;
|
||||
if (!ToNumber(cx, args[0], &result))
|
||||
if (!ToNumber(cx, args.handleAt(0), &result))
|
||||
return false;
|
||||
|
||||
dateObj->setUTCTime(TimeClip(result), args.rval().address());
|
||||
|
@ -1735,7 +1735,7 @@ GetMsecsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, dou
|
|||
*millis = msFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args[i], millis);
|
||||
return ToNumber(cx, args.handleAt(i), millis);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1745,7 +1745,7 @@ GetSecsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*sec = SecFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args[i], sec);
|
||||
return ToNumber(cx, args.handleAt(i), sec);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1755,7 +1755,7 @@ GetMinsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*mins = MinFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args[i], mins);
|
||||
return ToNumber(cx, args.handleAt(i), mins);
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.28. */
|
||||
|
@ -1769,7 +1769,7 @@ date_setMilliseconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double milli;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &milli))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &milli))
|
||||
return false;
|
||||
double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ date_setUTCMilliseconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double milli;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &milli))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &milli))
|
||||
return false;
|
||||
double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ date_setSeconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double s;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &s))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &s))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1866,7 +1866,7 @@ date_setUTCSeconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double s;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &s))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &s))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1903,7 +1903,7 @@ date_setMinutes_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &m))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1945,7 +1945,7 @@ date_setUTCMinutes_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &m))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1987,7 +1987,7 @@ date_setHours_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double h;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &h))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &h))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2034,7 +2034,7 @@ date_setUTCHours_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double h;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &h))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &h))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2081,7 +2081,7 @@ date_setDate_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double date;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &date))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &date))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2113,7 +2113,7 @@ date_setUTCDate_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double date;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &date))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &date))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2141,7 +2141,7 @@ GetDateOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*date = DateFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args[i], date);
|
||||
return ToNumber(cx, args.handleAt(i), date);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -2151,7 +2151,7 @@ GetMonthOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, dou
|
|||
*month = MonthFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args[i], month);
|
||||
return ToNumber(cx, args.handleAt(i), month);
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.38. */
|
||||
|
@ -2165,7 +2165,7 @@ date_setMonth_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &m))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2202,7 +2202,7 @@ date_setUTCMonth_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &m))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2255,7 +2255,7 @@ date_setFullYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &y))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2297,7 +2297,7 @@ date_setUTCFullYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &y))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2339,7 +2339,7 @@ date_setYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &y))
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -3003,7 +3003,7 @@ js_Date(JSContext *cx, unsigned argc, Value *vp)
|
|||
d = TimeClip(d);
|
||||
} else {
|
||||
/* Step 3. */
|
||||
if (!ToNumber(cx, args[0], &d))
|
||||
if (!ToNumber(cx, args.handleAt(0), &d))
|
||||
return false;
|
||||
d = TimeClip(d);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ js_math_abs(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
double z = Abs(x);
|
||||
|
@ -152,7 +152,7 @@ js::math_acos(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -185,7 +185,7 @@ js::math_asin(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -214,7 +214,7 @@ js::math_atan(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -267,7 +267,7 @@ js::math_atan2(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x) || !ToNumber(cx, args.handleAt(1), &y))
|
||||
return false;
|
||||
|
||||
double z = ecmaAtan2(x, y);
|
||||
|
@ -296,7 +296,7 @@ js_math_ceil(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
double z = js_math_ceil_impl(x);
|
||||
|
@ -321,7 +321,7 @@ js::math_cos(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -358,7 +358,7 @@ js::math_exp(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -387,7 +387,7 @@ js_math_floor(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
double z = js_math_floor_impl(x);
|
||||
|
@ -434,7 +434,7 @@ js::math_log(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -454,7 +454,7 @@ js_math_max(JSContext *cx, unsigned argc, Value *vp)
|
|||
double maxval = NegativeInfinity();
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
double x;
|
||||
if (!ToNumber(cx, args[i], &x))
|
||||
if (!ToNumber(cx, args.handleAt(i), &x))
|
||||
return false;
|
||||
// Math.max(num, NaN) => NaN, Math.max(-0, +0) => +0
|
||||
if (x > maxval || IsNaN(x) || (x == maxval && IsNegative(maxval)))
|
||||
|
@ -472,7 +472,7 @@ js_math_min(JSContext *cx, unsigned argc, Value *vp)
|
|||
double minval = PositiveInfinity();
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
double x;
|
||||
if (!ToNumber(cx, args[i], &x))
|
||||
if (!ToNumber(cx, args.handleAt(i), &x))
|
||||
return false;
|
||||
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
|
||||
if (x < minval || IsNaN(x) || (x == minval && IsNegativeZero(x)))
|
||||
|
@ -561,7 +561,7 @@ js_math_pow(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x) || !ToNumber(cx, args.handleAt(1), &y))
|
||||
return false;
|
||||
|
||||
/*
|
||||
|
@ -698,7 +698,7 @@ js_math_round(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
int32_t i;
|
||||
|
@ -734,7 +734,7 @@ js::math_sin(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -757,7 +757,7 @@ js_math_sqrt(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -786,7 +786,7 @@ js::math_tan(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
|
|
@ -233,29 +233,37 @@ js::GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int
|
|||
static JSBool
|
||||
num_isNaN(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
if (argc == 0) {
|
||||
vp->setBoolean(true);
|
||||
return JS_TRUE;
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.length() == 0) {
|
||||
args.rval().setBoolean(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, vp[2], &x))
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
vp->setBoolean(mozilla::IsNaN(x));
|
||||
return JS_TRUE;
|
||||
|
||||
args.rval().setBoolean(mozilla::IsNaN(x));
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
num_isFinite(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
if (argc == 0) {
|
||||
vp->setBoolean(false);
|
||||
return JS_TRUE;
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.length() == 0) {
|
||||
args.rval().setBoolean(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, vp[2], &x))
|
||||
return JS_FALSE;
|
||||
vp->setBoolean(mozilla::IsFinite(x));
|
||||
return JS_TRUE;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
return false;
|
||||
|
||||
args.rval().setBoolean(mozilla::IsFinite(x));
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -1343,8 +1351,8 @@ js::NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb)
|
|||
return sb.appendInflated(cstr, cstrlen);
|
||||
}
|
||||
|
||||
static bool
|
||||
StringToNumber(JSContext *cx, JSString *str, double *result)
|
||||
bool
|
||||
js::StringToNumber(JSContext *cx, JSString *str, double *result)
|
||||
{
|
||||
size_t length = str->length();
|
||||
const jschar *chars = str->getChars(NULL);
|
||||
|
|
|
@ -131,6 +131,9 @@ extern bool
|
|||
GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base,
|
||||
const jschar **endp, double *dp);
|
||||
|
||||
extern bool
|
||||
StringToNumber(JSContext *cx, JSString *str, double *result);
|
||||
|
||||
/* ES5 9.3 ToNumber, overwriting *vp with the appropriate number value. */
|
||||
JS_ALWAYS_INLINE bool
|
||||
ToNumber(JSContext *cx, JS::MutableHandleValue vp)
|
||||
|
|
|
@ -523,8 +523,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
|||
StringBuffer &sb)
|
||||
{
|
||||
RootedObject replacer(cx, replacer_);
|
||||
RootedValue spaceRoot(cx, space_);
|
||||
Value &space = spaceRoot.get();
|
||||
RootedValue space(cx, space_);
|
||||
|
||||
/* Step 4. */
|
||||
AutoIdVector propertyList(cx);
|
||||
|
@ -631,7 +630,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
|||
return false;
|
||||
space = NumberValue(d);
|
||||
} else if (ObjectClassIs(spaceObj, ESClass_String, cx)) {
|
||||
JSString *str = ToStringSlow<CanGC>(cx, spaceRoot);
|
||||
JSString *str = ToStringSlow<CanGC>(cx, space);
|
||||
if (!str)
|
||||
return false;
|
||||
space = StringValue(str);
|
||||
|
|
|
@ -1336,7 +1336,7 @@ str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
i = j;
|
||||
} else {
|
||||
double d;
|
||||
if (!ToNumber(cx, args[1], &d))
|
||||
if (!ToNumber(cx, args.handleAt(1), &d))
|
||||
return false;
|
||||
if (!IsNaN(d)) {
|
||||
d = ToInteger(d);
|
||||
|
@ -3059,7 +3059,7 @@ js::str_split(JSContext *cx, unsigned argc, Value *vp)
|
|||
uint32_t limit;
|
||||
if (args.hasDefined(1)) {
|
||||
double d;
|
||||
if (!ToNumber(cx, args[1], &d))
|
||||
if (!ToNumber(cx, args.handleAt(1), &d))
|
||||
return false;
|
||||
limit = ToUint32(d);
|
||||
} else {
|
||||
|
|
|
@ -2909,7 +2909,7 @@ DataViewObject::read(JSContext *cx, Handle<DataViewObject*> obj,
|
|||
|
||||
template <typename NativeType>
|
||||
static inline bool
|
||||
WebIDLCast(JSContext *cx, const Value &value, NativeType *out)
|
||||
WebIDLCast(JSContext *cx, HandleValue value, NativeType *out)
|
||||
{
|
||||
int32_t temp;
|
||||
if (!ToInt32(cx, value, &temp))
|
||||
|
@ -2923,7 +2923,7 @@ WebIDLCast(JSContext *cx, const Value &value, NativeType *out)
|
|||
|
||||
template <>
|
||||
inline bool
|
||||
WebIDLCast<float>(JSContext *cx, const Value &value, float *out)
|
||||
WebIDLCast<float>(JSContext *cx, HandleValue value, float *out)
|
||||
{
|
||||
double temp;
|
||||
if (!ToNumber(cx, value, &temp))
|
||||
|
@ -2934,7 +2934,7 @@ WebIDLCast<float>(JSContext *cx, const Value &value, float *out)
|
|||
|
||||
template <>
|
||||
inline bool
|
||||
WebIDLCast<double>(JSContext *cx, const Value &value, double *out)
|
||||
WebIDLCast<double>(JSContext *cx, HandleValue value, double *out)
|
||||
{
|
||||
return ToNumber(cx, value, out);
|
||||
}
|
||||
|
@ -2956,7 +2956,7 @@ DataViewObject::write(JSContext *cx, Handle<DataViewObject*> obj,
|
|||
return false;
|
||||
|
||||
NativeType value;
|
||||
if (!WebIDLCast(cx, args[1], &value))
|
||||
if (!WebIDLCast(cx, args.handleAt(1), &value))
|
||||
return false;
|
||||
|
||||
bool toLittleEndian = args.length() >= 3 && ToBoolean(args[2]);
|
||||
|
|
|
@ -922,7 +922,7 @@ TypedElementsHeader<T>::setElement(JSContext *cx, Handle<ObjectImpl*> obj,
|
|||
d = 0.0;
|
||||
} else if (v.isPrimitive()) {
|
||||
if (v.isString()) {
|
||||
if (!ToNumber(cx, v, &d))
|
||||
if (!StringToNumber(cx, v.toString(), &d))
|
||||
return false;
|
||||
} else if (v.isUndefined()) {
|
||||
d = js_NaN;
|
||||
|
|
Загрузка…
Ссылка в новой задаче