Bug 683802 - Force allocation for sized PWSTRINGs in XPCWrappedNative argument conversion. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 23 Sep 2011 14:50:29 -0700
changeset 77474 30472afa1c400403b0dc8cc44a09d882fc1fb240
parent 77473 3f69487fa2382164a4749cbd820816d3c250e84d
child 77475 3bfef7f630dc04b2c642d13d177c9b73bc8d962d
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersmrbkap
bugs683802
milestone9.0a1
Bug 683802 - Force allocation for sized PWSTRINGs in XPCWrappedNative argument conversion. r=mrbkap This is the last remaining place where we might pass a non-dipper with useAllocator==false to XPCConvert *and, as a consequence*, do something different within XPCConvert. This paves the way for the elimination of useAllocator for non-dipper types.
js/src/xpconnect/src/xpcwrappednative.cpp
--- a/js/src/xpconnect/src/xpcwrappednative.cpp
+++ b/js/src/xpconnect/src/xpcwrappednative.cpp
@@ -2986,17 +2986,18 @@ CallMethodHelper::ConvertDependentParams
         else
         {
             NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
                          "Expected either enough arguments or an optional argument");
             src = i < mArgc ? mArgv[i] : JSVAL_NULL;
 
             if((datum_type.IsPointer() &&
                 (datum_type.TagPart() == nsXPTType::T_IID ||
-                 datum_type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS)) ||
+                 datum_type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS) ||
+                 datum_type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS) ||
                (isArray && datum_type.TagPart() == nsXPTType::T_CHAR_STR))
             {
                 useAllocator = JS_TRUE;
                 dp->SetValNeedsCleanup();
             }
         }
 
         nsID param_iid;