Backed out changeset 3d9664b78ca7 (bug 884410) because of build bustage on a CLOSED TREE
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 15 Aug 2013 18:20:00 -0400
changeset 142814 911fcdcadf4d376a75eef78559e3225c01658be7
parent 142813 9161b68c5015bc6c764292d57b9af7d76fc2159c
child 142815 5efb6eb82909e06b8db712b9ba577e123c4f0cc1
push id32525
push usereakhgari@mozilla.com
push dateThu, 15 Aug 2013 22:20:36 +0000
treeherdermozilla-inbound@911fcdcadf4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs884410
milestone26.0a1
backs out3d9664b78ca7df42835305a500f8766040b64e9d
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 3d9664b78ca7 (bug 884410) because of build bustage on a CLOSED TREE
dom/base/nsJSEnvironment.cpp
dom/base/nsJSTimeoutHandler.cpp
js/src/jsapi.cpp
js/xpconnect/src/dictionary_helper_gen.py
js/xpconnect/src/qsgen.py
toolkit/components/telemetry/Telemetry.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1588,54 +1588,48 @@ TraceMallocOpenLogFile(JSContext *cx, un
     }
     JS_SET_RVAL(cx, vp, INT_TO_JSVAL(fd));
     return true;
 }
 
 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) {
             JS_ReportOutOfMemory(cx);
             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;
 }
 
 static bool
 TraceMallocLogTimestamp(JSContext *cx, unsigned argc, JS::Value *vp)
 {
     if (!CheckUniversalXPConnectForTraceMalloc(cx))
         return false;
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -186,25 +186,21 @@ nsJSScriptTimeoutHandler::Init(nsGlobalW
 
   if (argc < 1) {
     ::JS_ReportError(cx, "Function %s requires at least 2 parameter",
                      *aIsInterval ? kSetIntervalStr : kSetTimeoutStr);
     return NS_ERROR_DOM_TYPE_ERR;
   }
 
   int32_t interval = 0;
-  if (argc > 1) {
-    JS::Rooted<JS::Value> arg(cx, argv[1]);
-
-    if (!JS::ToInt32(cx, arg, &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 && !::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
     // setting an interval of 0 milliseconds.
     *aIsInterval = false;
   }
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -266,27 +266,26 @@ JS_ConvertArgumentsVA(JSContext *cx, uns
                         JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
                                              name, numBuf, (argc == 1) ? "" : "s");
                     }
                 }
                 return false;
             }
             break;
         }
-        RootedValue arg(cx, *sp);
         switch (c) {
           case 'b':
             *va_arg(ap, bool *) = ToBoolean(*sp);
             break;
           case 'c':
             if (!JS_ValueToUint16(cx, *sp, va_arg(ap, uint16_t *)))
                 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':
             if (!JS_ValueToECMAUint32(cx, *sp, va_arg(ap, uint32_t *)))
                 return false;
             break;
           case 'j':
             if (!JS_ValueToInt32(cx, *sp, va_arg(ap, int32_t *)))
@@ -470,16 +469,22 @@ JS_DoubleToInt32(double d)
 }
 
 JS_PUBLIC_API(uint32_t)
 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)
 {
     RootedValue value(cx, valueArg);
     return JS::ToUint32(cx, value, ip);
 }
 
--- a/js/xpconnect/src/dictionary_helper_gen.py
+++ b/js/xpconnect/src/dictionary_helper_gen.py
@@ -288,22 +288,22 @@ def write_getter(a, iface, fd):
         fd.write("    MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));\n")
         fd.write("    aDict.%s = b;\n" % a.name)
     elif realtype.count("uint16_t"):
         fd.write("    uint32_t u;\n")
         fd.write("    NS_ENSURE_STATE(JS_ValueToECMAUint32(aCx, v, &u));\n")
         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"):
         fd.write("    NS_ENSURE_STATE(JS::ToInt64(aCx, v, &aDict.%s));\n" % a.name)
     elif realtype.count("double"):
         fd.write("    NS_ENSURE_STATE(JS_ValueToNumber(aCx, v, &aDict.%s));\n" % a.name)
     elif realtype.count("float"):
         fd.write("    double d;\n")
--- a/js/xpconnect/src/qsgen.py
+++ b/js/xpconnect/src/qsgen.py
@@ -386,29 +386,29 @@ argumentUnboxingTemplates = {
     'octet':
         "    uint32_t ${name}_u32;\n"
         "    if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}_u32))\n"
         "        return false;\n"
         "    uint8_t ${name} = (uint8_t) ${name}_u32;\n",
 
     '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",
 
     'unsigned short':
         "    uint32_t ${name}_u32;\n"
         "    if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}_u32))\n"
         "        return false;\n"
         "    uint16_t ${name} = (uint16_t) ${name}_u32;\n",
 
     'long':
         "    int32_t ${name};\n"
-        "    if (!JS::ToInt32(cx, ${argVal}, &${name}))\n"
+        "    if (!JS_ValueToECMAInt32(cx, ${argVal}, &${name}))\n"
         "        return false;\n",
 
     'unsigned long':
         "    uint32_t ${name};\n"
         "    if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}))\n"
         "        return false;\n",
 
     'long long':
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -617,29 +617,30 @@ IsEmpty(const Histogram *h)
   h->SnapshotSample(&ss);
 
   return ss.counts(0) == 0 && ss.sum() == 0;
 }
 
 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;
   }
 
   if (TelemetryImpl::CanRecord()) {
     JSObject *obj = JS_THIS_OBJECT(cx, vp);
     if (!obj) {
       return false;
     }