Commit 9cbde50d authored by flamingice@sourmilk.net's avatar flamingice@sourmilk.net
Browse files

Bug 336214, Check all supported flavors, r+sr=roc

parent 433258bc
Loading
Loading
Loading
Loading
+33 −29
Original line number Diff line number Diff line
@@ -378,12 +378,15 @@ nsDragService::GetData(nsITransferable * aTransferable,

    if (isList) {
        PR_LOG(sDragLm, PR_LOG_DEBUG, ("it's a list..."));
        // find a matching flavor
        for (i = 0; i < cnt; ++i) {
            nsCOMPtr<nsISupports> genericWrapper;
        // there is always one element if it's a list
        flavorList->GetElementAt(0, getter_AddRefs(genericWrapper));
            flavorList->GetElementAt(i, getter_AddRefs(genericWrapper));
            nsCOMPtr<nsISupportsCString> currentFlavor;
            currentFlavor = do_QueryInterface(genericWrapper);
        if (currentFlavor) {
            if (!currentFlavor)
                continue;

            nsXPIDLCString flavorStr;
            currentFlavor->ToString(getter_Copies(flavorStr));
            PR_LOG(sDragLm,
@@ -394,7 +397,9 @@ nsDragService::GetData(nsITransferable * aTransferable,
            mSourceDataItems->GetElementAt(aItemIndex,
                                           getter_AddRefs(genericItem));
            nsCOMPtr<nsITransferable> item(do_QueryInterface(genericItem));
            if (item) {
            if (!item)
                continue;

            nsCOMPtr<nsISupports> data;
            PRUint32 tmpDataLen = 0;
            PR_LOG(sDragLm, PR_LOG_DEBUG,
@@ -405,7 +410,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
                                       &tmpDataLen);
            if (NS_FAILED(rv)) {
                PR_LOG(sDragLm, PR_LOG_DEBUG, ("failed.\n"));
                    return NS_ERROR_FAILURE;
                continue;
            }
            PR_LOG(sDragLm, PR_LOG_DEBUG, ("succeeded.\n"));
            rv = aTransferable->SetTransferData(flavorStr,data,tmpDataLen);
@@ -413,12 +418,11 @@ nsDragService::GetData(nsITransferable * aTransferable,
                PR_LOG(sDragLm,
                       PR_LOG_DEBUG,
                       ("fail to set transfer data into transferable!\n"));
                    return NS_ERROR_FAILURE;
                continue;
            }
            // ok, we got the data
            return NS_OK;
        }
        }
        // if we got this far, we failed
        return NS_ERROR_FAILURE;
    }