Bug 607292 - followup to address comments 16 and 20 from the bug
authorIgor Bukanov <igor@mir2.org>
Mon, 15 Nov 2010 23:11:07 +0100
changeset 57818 f394014be68ed4db7e45d28a5a6fec7cfc049871
parent 57817 d7543e6c50973881dc74005a329051e8af774e8f
child 57819 9420a20e5e5b0efb7d11806d119975209f992024
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
bugs607292
milestone2.0b8pre
Bug 607292 - followup to address comments 16 and 20 from the bug
js/src/jsapi.cpp
js/src/jsapi.h
js/src/xpconnect/src/xpcconvert.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -291,17 +291,16 @@ JS_ConvertArgumentsVA(JSContext *cx, uin
             if (!JS_ValueToNumber(cx, *sp, va_arg(ap, jsdouble *)))
                 return JS_FALSE;
             break;
           case 'I':
             if (!JS_ValueToNumber(cx, *sp, &d))
                 return JS_FALSE;
             *va_arg(ap, jsdouble *) = js_DoubleToInteger(d);
             break;
-          case 's':
           case 'S':
           case 'W':
             str = js_ValueToString(cx, Valueify(*sp));
             if (!str)
                 return JS_FALSE;
             *sp = STRING_TO_JSVAL(str);
             if (c == 'W') {
                 const jschar *chars = js_GetStringChars(cx, str);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -551,17 +551,16 @@ JS_GetEmptyStringValue(JSContext *cx);
  *
  *   b      JSBool          Boolean
  *   c      uint16/jschar   ECMA uint16, Unicode char
  *   i      int32           ECMA int32
  *   u      uint32          ECMA uint32
  *   j      int32           Rounded int32 (coordinate)
  *   d      jsdouble        IEEE double
  *   I      jsdouble        Integral IEEE double
- *   s      char *          C string
  *   S      JSString *      Unicode string, accessed by a JSString pointer
  *   W      jschar *        Unicode character vector, 0-terminated (W for wide)
  *   o      JSObject *      Object reference
  *   f      JSFunction *    Function private
  *   v      jsval           Argument value (no conversion)
  *   *      N/A             Skip this argument (no vararg)
  *   /      N/A             End of required arguments
  *
--- a/js/src/xpconnect/src/xpcconvert.cpp
+++ b/js/src/xpconnect/src/xpcconvert.cpp
@@ -995,17 +995,22 @@ XPCConvert::JSData2Native(XPCCallContext
                 if(!rs)
                     return JS_FALSE;
                 *((const nsACString**)d) = rs;
             }
             else
             {
                 rs = *((nsACString**)d);
             }
+
             rs->SetLength(PRUint32(length));
+            if(rs->Length() != PRUint32(length))
+            {
+                return JS_FALSE;
+            }
             JS_EncodeStringToBuffer(str, rs->BeginWriting(), length);
 
             return JS_TRUE;
         }
 
         case nsXPTType::T_INTERFACE:
         case nsXPTType::T_INTERFACE_IS:
         {