[JAEGER] Merge.
authorDavid Mandelin <dmandelin@mozilla.com>
Tue, 17 Aug 2010 18:45:57 -0700
changeset 53450 43e1eedfc1ccc6bdea17a6e92773607eb84c8473
parent 53449 c74dc777c5c69b6123855e5efe5a1146853e819f (current diff)
parent 53448 6e5e2f31795bbfdb189e0c0a62cb47cc522d5d97 (diff)
child 53451 c74a3e0705bf94089da7c99da12f1f4303fa6d87
push idunknown
push userunknown
push dateunknown
milestone2.0b4pre
[JAEGER] Merge.
--- a/modules/plugin/base/src/nsJSNPRuntime.cpp
+++ b/modules/plugin/base/src/nsJSNPRuntime.cpp
@@ -452,17 +452,23 @@ JSValToNPVariant(NPP npp, JSContext *cx,
       VOID_TO_NPVARIANT(*variant);
     } else if (JSVAL_IS_NULL(val)) {
       NULL_TO_NPVARIANT(*variant);
     } else if (JSVAL_IS_BOOLEAN(val)) {
       BOOLEAN_TO_NPVARIANT(JSVAL_TO_BOOLEAN(val), *variant);
     } else if (JSVAL_IS_INT(val)) {
       INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
     } else if (JSVAL_IS_DOUBLE(val)) {
-      DOUBLE_TO_NPVARIANT(JSVAL_TO_DOUBLE(val), *variant);
+      jsdouble d = JSVAL_TO_DOUBLE(val);
+      jsint i;
+      if (JS_DoubleIsInt32(d, &i)) {
+        INT32_TO_NPVARIANT(i, *variant);
+      } else {
+        DOUBLE_TO_NPVARIANT(d, *variant);
+      }
     } else if (JSVAL_IS_STRING(val)) {
       JSString *jsstr = JSVAL_TO_STRING(val);
       nsDependentString str((PRUnichar *)::JS_GetStringChars(jsstr),
                             ::JS_GetStringLength(jsstr));
 
       PRUint32 len;
       char *p = ToNewUTF8String(str, &len);