[xpcom] Check for DataCarrier in addVariantToIter()
authorKalle Vahlman <kalle.vahlman@movial.com>
Thu, 30 Apr 2009 07:05:30 +0000 (10:05 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Thu, 30 Apr 2009 07:05:30 +0000 (10:05 +0300)
xpcom-dbusservice/DBusMarshaling.cpp

index 2aaea8d3a0164af640c92ddb5019f8a307f15c19..38e2122246358312013918c26078427dee71e6e8 100644 (file)
@@ -407,6 +407,25 @@ addVariantToIter(JSContext* cx, nsIVariant *aVariant, DBusMessageIter *aIter, DB
     dbus_free(element_signature);
 #endif
 
+    // If the carrier has a nsISupports, check for DataCarrier
+    if (variant_type == nsIDataType::VTYPE_INTERFACE_IS)
+    {
+        nsCOMPtr<nsISupports> is;
+        nsIID *iid;
+
+        if (NS_FAILED(aVariant->GetAsInterface(&iid, getter_AddRefs(is))))
+            return;
+
+        nsCOMPtr<DBusDataCarrier> myCarrier = do_QueryInterface(is);
+        if (myCarrier) {
+            nsCOMPtr<nsIVariant> myValue;
+            myCarrier->GetValue(getter_AddRefs(myValue));
+            addVariantToIter(cx, myValue, aIter, aSigIter);
+            return;
+        }
+    }
+
+
     if (dbus_type_is_basic(element_type))
     {
         BDBLOG(("  add basic type from variant\n"));