Bug 1493292 - Remove len from nsIFlavorDataProvider r=smaug
☠☠ backed out by 4b0554a10847 ☠ ☠
authorTom Schuster <evilpies@gmail.com>
Tue, 20 Nov 2018 14:47:11 +0000
changeset 506442 6487aa307123e63554a714e0cece6273e57017b1
parent 506441 f2cabd69c568bd5e6f50f7f3f5d6f5d55c6b7222
child 506443 f198bf91320bf774f2c9f204c426ac0c2da95aa2
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1493292
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1493292 - Remove len from nsIFlavorDataProvider r=smaug Depends on D11203 Differential Revision: https://phabricator.services.mozilla.com/D11204
dom/base/nsContentAreaDragDrop.cpp
widget/nsITransferable.idl
widget/nsTransferable.cpp
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -225,22 +225,20 @@ CheckAndGetExtensionForMime(const nsCStr
 //    transferable with an nsIFile for the directory we are to
 //    save in. That has to be done by platform-specific code (in
 //    widget), which gets the destination directory from
 //    OS-specific drag information.
 //
 NS_IMETHODIMP
 nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
                                                  const char *aFlavor,
-                                                 nsISupports **aData,
-                                                 uint32_t *aDataLen)
+                                                 nsISupports **aData)
 {
-  NS_ENSURE_ARG_POINTER(aData && aDataLen);
+  NS_ENSURE_ARG_POINTER(aData);
   *aData = nullptr;
-  *aDataLen = 0;
 
   nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
 
   if (strcmp(aFlavor, kFilePromiseMime) == 0) {
     // get the URI from the kFilePromiseURLMime flavor
     NS_ENSURE_ARG(aTransferable);
     nsCOMPtr<nsISupports> tmp;
     aTransferable->GetTransferData(kFilePromiseURLMime, getter_AddRefs(tmp));
@@ -340,17 +338,16 @@ nsContentAreaDragDropDataProvider::GetFl
 
     bool isPrivate = aTransferable->GetIsPrivateData();
 
     nsCOMPtr<nsIPrincipal> principal = aTransferable->GetRequestingPrincipal();
     rv = SaveURIToFile(sourceURI, principal, file, isPrivate);
     // send back an nsIFile
     if (NS_SUCCEEDED(rv)) {
       CallQueryInterface(file, aData);
-      *aDataLen = sizeof(nsIFile*);
     }
   }
 
   return rv;
 }
 
 DragDataProducer::DragDataProducer(nsPIDOMWindowOuter* aWindow,
                                    nsIContent* aTarget,
--- a/widget/nsITransferable.idl
+++ b/widget/nsITransferable.idl
@@ -81,19 +81,18 @@ interface nsIFlavorDataProvider : nsISup
 {
 
   /**
     * Retrieve the data from this data provider.
     *
     * @param  aTransferable (in parameter) the transferable we're being called for.
     * @param  aFlavor (in parameter) the flavor of data to retrieve
     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
-    * @param  aDataLen the length of the data
     */
-  void getFlavorData(in nsITransferable aTransferable, in string aFlavor, out nsISupports aData, out unsigned long aDataLen);
+  void getFlavorData(in nsITransferable aTransferable, in string aFlavor, out nsISupports aData);
 };
 
 
 [scriptable, uuid(97e0c418-1c1e-4106-bad1-9fcb11dff2fe)]
 interface nsITransferable : nsISupports
 {
   /**
    * Initializes a transferable object.  This should be called on all
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -265,19 +265,18 @@ nsTransferable::GetTransferData(const ch
   // First look and see if the data is present in one of the intrinsic flavors.
   if (Maybe<size_t> index = FindDataFlavor(aFlavor)) {
     nsCOMPtr<nsISupports> dataBytes;
     mDataArray[index.value()].GetData(getter_AddRefs(dataBytes));
 
     // Do we have a (lazy) data provider?
     if (nsCOMPtr<nsIFlavorDataProvider> dataProvider =
           do_QueryInterface(dataBytes)) {
-      uint32_t len;
       rv = dataProvider->GetFlavorData(this, aFlavor,
-                                       getter_AddRefs(dataBytes), &len);
+                                       getter_AddRefs(dataBytes));
       if (NS_FAILED(rv)) {
         dataBytes = nullptr;
         // The provider failed, fall into the converter code below.
       }
     }
 
     if (dataBytes) {
       dataBytes.forget(aData);
@@ -293,29 +292,28 @@ nsTransferable::GetTransferData(const ch
       DataStruct& data = mDataArray.ElementAt(i);
       bool canConvert = false;
       mFormatConv->CanConvert(data.GetFlavor().get(), aFlavor, &canConvert);
       if (canConvert) {
         nsCOMPtr<nsISupports> dataBytes;
         data.GetData(getter_AddRefs(dataBytes));
 
         // Do we have a (lazy) data provider?
-        uint32_t len;
         if (nsCOMPtr<nsIFlavorDataProvider> dataProvider =
               do_QueryInterface(dataBytes)) {
           rv = dataProvider->GetFlavorData(this, aFlavor,
-                                           getter_AddRefs(dataBytes), &len);
+                                           getter_AddRefs(dataBytes));
           if (NS_FAILED(rv)) {
             // Give up.
             return rv;
           }
         }
 
         uint32_t dataLen;
-        return mFormatConv->Convert(data.GetFlavor().get(), dataBytes, len,
+        return mFormatConv->Convert(data.GetFlavor().get(), dataBytes, 0,
                                     aFlavor, aData, &dataLen);
       }
     }
   }
 
   return NS_ERROR_FAILURE;
 }