mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Backed out changeset 3d9664b78ca7 (bug 884410) because of build bustage on a CLOSED TREE
This commit is contained in:
parent
1131972e0e
commit
1ed269270a
@ -1593,16 +1593,14 @@ TraceMallocOpenLogFile(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
static bool
|
||||
TraceMallocChangeLogFD(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(cx, vp);
|
||||
|
||||
if (!CheckUniversalXPConnectForTraceMalloc(cx))
|
||||
return false;
|
||||
|
||||
int32_t fd, oldfd;
|
||||
if (args.length() == 0) {
|
||||
if (argc == 0) {
|
||||
oldfd = -1;
|
||||
} else {
|
||||
if (!JS::ToInt32(cx, args[0], &fd))
|
||||
if (!JS_ValueToECMAInt32(cx, JS_ARGV(cx, vp)[0], &fd))
|
||||
return false;
|
||||
oldfd = NS_TraceMallocChangeLogFD(fd);
|
||||
if (oldfd == -2) {
|
||||
@ -1610,27 +1608,23 @@ TraceMallocChangeLogFD(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
args.rval().setInt32(oldfd);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(oldfd));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
TraceMallocCloseLogFD(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(cx, vp);
|
||||
|
||||
if (!CheckUniversalXPConnectForTraceMalloc(cx))
|
||||
return false;
|
||||
|
||||
int32_t fd;
|
||||
if (args.length() == 0) {
|
||||
args.rval().setUndefined();
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
if (argc == 0)
|
||||
return true;
|
||||
}
|
||||
if (!JS::ToInt32(cx, args[0], &fd))
|
||||
if (!JS_ValueToECMAInt32(cx, JS_ARGV(cx, vp)[0], &fd))
|
||||
return false;
|
||||
NS_TraceMallocCloseLogFD((int) fd);
|
||||
args.rval().setInt32(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -191,16 +191,12 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
|
||||
}
|
||||
|
||||
int32_t interval = 0;
|
||||
if (argc > 1) {
|
||||
JS::Rooted<JS::Value> arg(cx, argv[1]);
|
||||
|
||||
if (!JS::ToInt32(cx, arg, &interval)) {
|
||||
if (argc > 1 && !::JS_ValueToECMAInt32(cx, argv[1], &interval)) {
|
||||
::JS_ReportError(cx,
|
||||
"Second argument to %s must be a millisecond interval",
|
||||
aIsInterval ? kSetIntervalStr : kSetTimeoutStr);
|
||||
return NS_ERROR_DOM_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
// If no interval was specified, treat this like a timeout, to avoid
|
||||
|
@ -271,7 +271,6 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
|
||||
}
|
||||
break;
|
||||
}
|
||||
RootedValue arg(cx, *sp);
|
||||
switch (c) {
|
||||
case 'b':
|
||||
*va_arg(ap, bool *) = ToBoolean(*sp);
|
||||
@ -281,7 +280,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
|
||||
return false;
|
||||
break;
|
||||
case 'i':
|
||||
if (!ToInt32(cx, arg, va_arg(ap, int32_t *)))
|
||||
if (!JS_ValueToECMAInt32(cx, *sp, va_arg(ap, int32_t *)))
|
||||
return false;
|
||||
break;
|
||||
case 'u':
|
||||
@ -475,6 +474,12 @@ JS_DoubleToUint32(double d)
|
||||
return ToUint32(d);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_ValueToECMAInt32(JSContext *cx, jsval valueArg, int32_t *ip)
|
||||
{
|
||||
RootedValue value(cx, valueArg);
|
||||
return JS::ToInt32(cx, value, ip);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_ValueToECMAUint32(JSContext *cx, jsval valueArg, uint32_t *ip)
|
||||
|
@ -293,12 +293,12 @@ def write_getter(a, iface, fd):
|
||||
fd.write(" aDict.%s = u;\n" % a.name)
|
||||
elif realtype.count("int16_t"):
|
||||
fd.write(" int32_t i;\n")
|
||||
fd.write(" NS_ENSURE_STATE(JS::ToInt32(aCx, v, &i));\n")
|
||||
fd.write(" NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &i));\n")
|
||||
fd.write(" aDict.%s = i;\n" % a.name)
|
||||
elif realtype.count("uint32_t"):
|
||||
fd.write(" NS_ENSURE_STATE(JS_ValueToECMAUint32(aCx, v, &aDict.%s));\n" % a.name)
|
||||
elif realtype.count("int32_t"):
|
||||
fd.write(" NS_ENSURE_STATE(JS::ToInt32(aCx, v, &aDict.%s));\n" % a.name)
|
||||
fd.write(" NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.%s));\n" % a.name)
|
||||
elif realtype.count("uint64_t"):
|
||||
fd.write(" NS_ENSURE_STATE(JS::ToUint64(aCx, v, &aDict.%s));\n" % a.name)
|
||||
elif realtype.count("int64_t"):
|
||||
|
@ -391,7 +391,7 @@ argumentUnboxingTemplates = {
|
||||
|
||||
'short':
|
||||
" int32_t ${name}_i32;\n"
|
||||
" if (!JS::ToInt32(cx, ${argVal}, &${name}_i32))\n"
|
||||
" if (!JS_ValueToECMAInt32(cx, ${argVal}, &${name}_i32))\n"
|
||||
" return false;\n"
|
||||
" int16_t ${name} = (int16_t) ${name}_i32;\n",
|
||||
|
||||
@ -403,7 +403,7 @@ argumentUnboxingTemplates = {
|
||||
|
||||
'long':
|
||||
" int32_t ${name};\n"
|
||||
" if (!JS::ToInt32(cx, ${argVal}, &${name}))\n"
|
||||
" if (!JS_ValueToECMAInt32(cx, ${argVal}, &${name}))\n"
|
||||
" return false;\n",
|
||||
|
||||
'unsigned long':
|
||||
|
@ -622,19 +622,20 @@ IsEmpty(const Histogram *h)
|
||||
bool
|
||||
JSHistogram_Add(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (!args.length()) {
|
||||
if (!argc) {
|
||||
JS_ReportError(cx, "Expected one argument");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(args[0].isNumber() || args[0].isBoolean())) {
|
||||
JS::Value v = JS_ARGV(cx, vp)[0];
|
||||
|
||||
if (!(JSVAL_IS_NUMBER(v) || JSVAL_IS_BOOLEAN(v))) {
|
||||
JS_ReportError(cx, "Not a number");
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t value;
|
||||
if (!JS::ToInt32(cx, args[0], &value)) {
|
||||
if (!JS_ValueToECMAInt32(cx, v, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user