Bug 683802 - Force allocation for sized PWSTRINGs in XPCWrappedNative argument conversion. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Sun, 25 Sep 2011 15:38:01 +0100
changeset 77537 44d1fafa07d0ae0d3f4f0ee212ab060ab5b35d16
parent 77536 95701554f3480e562c62b22ef4b0a122006b0ade
child 77538 1a6a02df6029e6feb263c534962a8f228957bb2e
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;