Bug 1493292 - Remove len from nsIFlavorDataProvider r=smaug
authorTom Schuster <evilpies@gmail.com>
Tue, 20 Nov 2018 17:01:44 +0000
changeset 503688 8c6a2b35442221490d60b2be9f50949c9fad585a
parent 503687 f02e1aba84a57e121894c2c7a25352ab7f210d9c
child 503689 bd64f10454cc0693bb9932d6203765d005cbd970
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [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;
 }