Bug 1493292 - Remove aDataLen parameters from nsITransferable.setTransferData. r=smaug
authorTom Schuster <evilpies@gmail.com>
Tue, 20 Nov 2018 17:00:09 +0000
changeset 506466 7e2c0177115a4620627a9c15027e960116c0c394
parent 506465 a58e50deefdc260cef3514c1552e4355ea5a6024
child 506467 f02e1aba84a57e121894c2c7a25352ab7f210d9c
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 aDataLen parameters from nsITransferable.setTransferData. r=smaug Depends on D11201 Differential Revision: https://phabricator.services.mozilla.com/D11202
dom/base/nsContentUtils.cpp
dom/base/nsCopySupport.cpp
dom/events/DataTransfer.cpp
widget/android/nsClipboard.cpp
widget/cocoa/nsChildView.mm
widget/cocoa/nsClipboard.mm
widget/cocoa/nsDragService.mm
widget/gtk/nsClipboard.cpp
widget/gtk/nsDragService.cpp
widget/headless/HeadlessClipboard.cpp
widget/nsClipboardHelper.cpp
widget/nsClipboardProxy.cpp
widget/nsITransferable.idl
widget/nsTransferable.cpp
widget/tests/test_bug565392.html
widget/windows/nsClipboard.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7750,41 +7750,40 @@ nsContentUtils::IPCTransferableToTransfe
       nsCOMPtr<nsISupportsString> dataWrapper =
         do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       const nsString& text = item.data().get_nsString();
       rv = dataWrapper->SetData(text);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper,
-                                  text.Length() * sizeof(char16_t));
+      rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper);
 
       NS_ENSURE_SUCCESS(rv, rv);
     } else if (item.data().type() == IPCDataTransferData::TShmem) {
       if (nsContentUtils::IsFlavorImage(item.flavor())) {
         nsCOMPtr<imgIContainer> imageContainer;
         rv = nsContentUtils::DataTransferItemToImage(item,
                                                      getter_AddRefs(imageContainer));
         NS_ENSURE_SUCCESS(rv, rv);
 
-        aTransferable->SetTransferData(item.flavor().get(), imageContainer, sizeof(nsISupports*));
+        aTransferable->SetTransferData(item.flavor().get(), imageContainer);
       } else {
         nsCOMPtr<nsISupportsCString> dataWrapper =
           do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
         NS_ENSURE_SUCCESS(rv, rv);
 
         // The buffer contains the terminating null.
         Shmem itemData = item.data().get_Shmem();
         const nsDependentCSubstring text(itemData.get<char>(),
                                          itemData.Size<char>());
         rv = dataWrapper->SetData(text);
         NS_ENSURE_SUCCESS(rv, rv);
 
-        rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper, text.Length());
+        rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper);
 
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       if (aContentParent) {
         Unused << aContentParent->DeallocShmem(item.data().get_Shmem());
       } else if (aTabChild) {
         Unused << aTabChild->DeallocShmem(item.data().get_Shmem());
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -410,18 +410,17 @@ nsCopySupport::ImageCopy(nsIImageLoading
     NS_ENSURE_TRUE(image, NS_ERROR_FAILURE);
 
 #ifdef XP_WIN
     rv = AppendImagePromise(trans, imgRequest, aImageElement);
     NS_ENSURE_SUCCESS(rv, rv);
 #endif
 
     // copy the image data onto the transferable
-    rv = trans->SetTransferData(kNativeImageMime, image,
-                                sizeof(nsISupports*));
+    rv = trans->SetTransferData(kNativeImageMime, image);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // get clipboard
   nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // check whether the system supports the selection clipboard or not.
@@ -449,18 +448,17 @@ static nsresult AppendString(nsITransfer
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = data->SetData(aString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aTransferable->AddDataFlavor(aFlavor);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return aTransferable->SetTransferData(aFlavor, data,
-                                        aString.Length() * sizeof(char16_t));
+  return aTransferable->SetTransferData(aFlavor, data);
 }
 
 static nsresult AppendDOMNode(nsITransferable *aTransferable,
                               nsINode *aDOMNode)
 {
   nsresult rv;
 
   // serializer
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -1071,18 +1071,17 @@ DataTransfer::GetTransferable(uint32_t a
 
               nsCString str;
               stringBuffer->ToString(totalCustomLength, str);
               nsCOMPtr<nsISupportsCString>
                 strSupports(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
               strSupports->SetData(str);
 
               nsresult rv = transferable->SetTransferData(kCustomTypesMime,
-                                                          strSupports,
-                                                          totalCustomLength);
+                                                          strSupports);
               if (NS_FAILED(rv)) {
                 return nullptr;
               }
 
               added = true;
             }
           }
         }
@@ -1112,18 +1111,17 @@ DataTransfer::GetTransferable(uint32_t a
         nsCOMPtr<nsIFormatConverter> converter =
           do_QueryInterface(convertedData);
         if (converter) {
           transferable->AddDataFlavor(format);
           transferable->SetConverter(converter);
           continue;
         }
 
-        nsresult rv = transferable->SetTransferData(format, convertedData,
-                                                    lengthInBytes);
+        nsresult rv = transferable->SetTransferData(format, convertedData);
         if (NS_FAILED(rv)) {
           return nullptr;
         }
 
         added = true;
       }
     }
 
--- a/widget/android/nsClipboard.cpp
+++ b/widget/android/nsClipboard.cpp
@@ -66,18 +66,17 @@ nsClipboard::GetData(nsITransferable *aT
   rv = dataWrapper->SetData(buffer);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If our data flavor has already been added, this will fail. But we don't care
   aTransferable->AddDataFlavor(kUnicodeMime);
 
   nsCOMPtr<nsISupports> nsisupportsDataWrapper =
     do_QueryInterface(dataWrapper);
-  rv = aTransferable->SetTransferData(kUnicodeMime, nsisupportsDataWrapper,
-                                      buffer.Length() * sizeof(char16_t));
+  rv = aTransferable->SetTransferData(kUnicodeMime, nsisupportsDataWrapper);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
 {
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -6246,18 +6246,17 @@ provideDataForType:(NSString*)aType
         for (uint32_t i = 0; i < transferableCount; i++) {
           nsCOMPtr<nsITransferable> item =
             do_QueryElementAt(gDraggedTransferables, i);
           if (!item) {
             NS_ERROR("no transferable");
             continue;
           }
 
-          item->SetTransferData(kFilePromiseDirectoryMime, macLocalFile,
-                                sizeof(nsIFile*));
+          item->SetTransferData(kFilePromiseDirectoryMime, macLocalFile);
 
           // Now request the kFilePromiseMime data, which will invoke the data
           // provider. If successful, the file will have been created.
           nsCOMPtr<nsISupports> fileDataPrimitive;
           item->GetTransferData(kFilePromiseMime,
                                 getter_AddRefs(fileDataPrimitive));
         }
         CFRelease(urlRef);
--- a/widget/cocoa/nsClipboard.mm
+++ b/widget/cocoa/nsClipboard.mm
@@ -234,17 +234,17 @@ nsClipboard::TransferableFromPasteboard(
            (clipboardDataPtrNoBOM[0] == 0xFFFE))) {
         dataLength -= sizeof(char16_t);
         clipboardDataPtrNoBOM += 1;
       }
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtrNoBOM, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
-      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
       free(clipboardDataPtr);
       break;
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
       NSString* type =
         [cocoaPasteboard availableTypeFromArray:
           [NSArray arrayWithObject:
             [UTIHelper stringFromPboardType:kMozCustomTypesPboardType]]];
@@ -264,17 +264,17 @@ nsClipboard::TransferableFromPasteboard(
         return NS_ERROR_OUT_OF_MEMORY;
       }
       [pasteboardData getBytes:clipboardDataPtr];
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
 
-      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
       free(clipboardDataPtr);
     }
     else if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
              flavorStr.EqualsLiteral(kJPGImageMime) ||
              flavorStr.EqualsLiteral(kPNGImageMime) ||
              flavorStr.EqualsLiteral(kGIFImageMime)) {
       // Figure out if there's data on the pasteboard we can grab (sanity check)
       NSString* type =
@@ -331,17 +331,17 @@ nsClipboard::TransferableFromPasteboard(
       bool successfullyConverted = CGImageDestinationFinalize(dest);
 
       if (successfullyConverted) {
         // Put the converted data in a form Gecko can understand
         nsCOMPtr<nsIInputStream> byteStream;
         NS_NewByteInputStream(getter_AddRefs(byteStream), (const char*)[encodedData bytes],
                                    [encodedData length], NS_ASSIGNMENT_COPY);
   
-        aTransferable->SetTransferData(flavorStr.get(), byteStream, sizeof(nsIInputStream*));
+        aTransferable->SetTransferData(flavorStr.get(), byteStream);
       }
 
       if (dest)
         CFRelease(dest);
       if (source)
         CFRelease(source);
       
       if (successfullyConverted)
@@ -386,17 +386,17 @@ nsClipboard::GetNativeClipboardData(nsIT
       mChangeCount == [cocoaPasteboard changeCount]) {
     if (mTransferable) {
       for (uint32_t i = 0; i < flavors.Length(); i++) {
         nsCString& flavorStr = flavors[i];
 
         nsCOMPtr<nsISupports> dataSupports;
         rv = mTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports));
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr.get(), dataSupports, 0);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports);
           return NS_OK; // maybe try to fill in more types? Is there a point?
         }
       }
     }
   } else {
     EmptyClipboard(aWhichClipboard);
   }
 
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -390,17 +390,17 @@ nsDragService::GetData(nsITransferable* 
     nsCOMPtr<nsITransferable> currentTransferable = do_QueryElementAt(mDataItems, aItemIndex);
     if (currentTransferable) {
       for (uint32_t i = 0; i < flavors.Length(); i++) {
         nsCString& flavorStr = flavors[i];
 
         nsCOMPtr<nsISupports> dataSupports;
         rv = currentTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports));
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr.get(), dataSupports, 0);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports);
           return NS_OK; // maybe try to fill in more types? Is there a point?
         }
       }
     }
   }
 
   // now check the actual clipboard for data
   for (uint32_t i = 0; i < flavors.Length(); i++) {
@@ -437,17 +437,17 @@ nsDragService::GetData(nsITransferable* 
       clipboardDataPtr[stringLength] = 0; // null terminate
 
       nsCOMPtr<nsIFile> file;
       rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), true, getter_AddRefs(file));
       free(clipboardDataPtr);
       if (NS_FAILED(rv))
         continue;
 
-      aTransferable->SetTransferData(flavorStr.get(), file, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), file);
       
       break;
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
       NSString* availableType =
         [item availableTypeFromArray:
           [NSArray arrayWithObject:kMozCustomTypesPboardType]];
       if (!availableType || !IsValidType(availableType, false)) {
@@ -464,17 +464,17 @@ nsDragService::GetData(nsITransferable* 
         return NS_ERROR_OUT_OF_MEMORY;
       }
       [pasteboardData getBytes:clipboardDataPtr];
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
 
-      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, sizeof(nsIInputStream*));
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
       free(clipboardDataPtr);
       break;
     }
 
     NSString* pString = nil;
     if (flavorStr.EqualsLiteral(kUnicodeMime)) {
       pString =
         GetStringForType(
@@ -530,17 +530,17 @@ nsDragService::GetData(nsITransferable* 
            (clipboardDataPtrNoBOM[0] == 0xFFFE))) {
         dataLength -= sizeof(char16_t);
         clipboardDataPtrNoBOM += 1;
       }
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtrNoBOM, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
-      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
       free(clipboardDataPtr);
       break;
     }
 
     // We have never supported this on Mac OS X, we should someday. Normally dragging images
     // in is accomplished with a file path drag instead of the image data itself.
     /*
     if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -231,18 +231,17 @@ nsClipboard::SetTransferableData(nsITran
                                  const char*      aClipboardData,
                                  uint32_t         aClipboardDataLength)
 {
   nsCOMPtr<nsISupports> wrapper;
   nsPrimitiveHelpers::CreatePrimitiveForData(aFlavor,
                                              aClipboardData,
                                              aClipboardDataLength,
                                              getter_AddRefs(wrapper));
-  aTransferable->SetTransferData(aFlavor.get(),
-                                 wrapper, aClipboardDataLength);
+  aTransferable->SetTransferData(aFlavor.get(), wrapper);
 }
 
 NS_IMETHODIMP
 nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
 {
     if (!aTransferable)
         return NS_ERROR_FAILURE;
 
@@ -273,18 +272,17 @@ nsClipboard::GetData(nsITransferable *aT
             if (!clipboardData)
                 continue;
 
             nsCOMPtr<nsIInputStream> byteStream;
             NS_NewByteInputStream(getter_AddRefs(byteStream),
                                   clipboardData,
                                   clipboardDataLength,
                                   NS_ASSIGNMENT_COPY);
-            aTransferable->SetTransferData(flavorStr.get(), byteStream,
-                                           sizeof(nsIInputStream*));
+            aTransferable->SetTransferData(flavorStr.get(), byteStream);
 
             mContext->ReleaseClipboardData(clipboardData);
             return NS_OK;
         }
 
         // Special case text/unicode since we can convert any
         // string into text/unicode
         if (flavorStr.EqualsLiteral(kUnicodeMime)) {
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -714,17 +714,17 @@ nsDragService::GetData(nsITransferable *
                    flavorStr.get()));
             rv = item->GetTransferData(flavorStr.get(),
                                        getter_AddRefs(data));
             if (NS_FAILED(rv)) {
                 MOZ_LOG(sDragLm, LogLevel::Debug, ("failed.\n"));
                 continue;
             }
             MOZ_LOG(sDragLm, LogLevel::Debug, ("succeeded.\n"));
-            rv = aTransferable->SetTransferData(flavorStr.get(), data, 0);
+            rv = aTransferable->SetTransferData(flavorStr.get(), data);
             if (NS_FAILED(rv)) {
                 MOZ_LOG(sDragLm,
                        LogLevel::Debug,
                        ("fail to set transfer data into transferable!\n"));
                 continue;
             }
             // ok, we got the data
             return NS_OK;
@@ -781,18 +781,17 @@ nsDragService::GetData(nsITransferable *
                                 nsCOMPtr<nsIFile> file;
                                 rv = fileURL->GetFile(getter_AddRefs(file));
                                 if (NS_SUCCEEDED(rv)) {
                                     // The common wrapping code at the end of
                                     // this function assumes the data is text
                                     // and calls text-specific operations.
                                     // Make a secret hideout here for nsIFile
                                     // objects and return early.
-                                    aTransferable->SetTransferData(flavorStr.get(), file,
-                                                                   convertedTextLen);
+                                    aTransferable->SetTransferData(flavorStr.get(), file);
                                     g_free(convertedText);
                                     return NS_OK;
                                 }
                             }
                         }
                         g_free(convertedText);
                     }
                     continue;
@@ -935,18 +934,17 @@ nsDragService::GetData(nsITransferable *
             }
 
             // put it into the transferable.
             nsCOMPtr<nsISupports> genericDataWrapper;
             nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr,
                                 mTargetDragData, mTargetDragDataLen,
                                 getter_AddRefs(genericDataWrapper));
             aTransferable->SetTransferData(flavorStr.get(),
-                                           genericDataWrapper,
-                                           mTargetDragDataLen);
+                                           genericDataWrapper);
             // we found one, get out of this loop!
             MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound and converted!\n"));
             break;
         }
     }
 
     return NS_OK;
 
@@ -1645,30 +1643,28 @@ nsDragService::SourceDataGet(GtkWidget  
             }
 
             // We have to split the path into a directory and filename,
             // because our internal file-promise API is based on these.
 
             nsCOMPtr<nsIFile> directory;
             file->GetParent(getter_AddRefs(directory));
 
-            item->SetTransferData(kFilePromiseDirectoryMime, directory,
-                                  sizeof(nsIFile*));
+            item->SetTransferData(kFilePromiseDirectoryMime, directory);
 
             nsCOMPtr<nsISupportsString> filenamePrimitive =
                 do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
             if (!filenamePrimitive)
                 return;
 
             nsAutoString leafName;
             file->GetLeafName(leafName);
             filenamePrimitive->SetData(leafName);
 
-            item->SetTransferData(kFilePromiseDestFilename, filenamePrimitive,
-                                  leafName.Length() * sizeof(PRUnichar));
+            item->SetTransferData(kFilePromiseDestFilename, filenamePrimitive);
 
             // Request a different type in GetTransferData.
             actualFlavor = kFilePromiseMime;
         } else {
             actualFlavor = mimeFlavor.get();
         }
         nsresult rv;
         nsCOMPtr<nsISupports> data;
--- a/widget/headless/HeadlessClipboard.cpp
+++ b/widget/headless/HeadlessClipboard.cpp
@@ -59,18 +59,17 @@ HeadlessClipboard::GetData(nsITransferab
   nsresult rv;
   nsCOMPtr<nsISupportsString> dataWrapper =
     do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
   rv = dataWrapper->SetData(mClipboard->GetText());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   nsCOMPtr<nsISupports> genericDataWrapper = do_QueryInterface(dataWrapper);
-  uint32_t len = mClipboard->GetText().Length() * sizeof(char16_t);
-  rv = aTransferable->SetTransferData(kUnicodeMime, genericDataWrapper, len);
+  rv = aTransferable->SetTransferData(kUnicodeMime, genericDataWrapper);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HeadlessClipboard::EmptyClipboard(int32_t aWhichClipboard)
--- a/widget/nsClipboardHelper.cpp
+++ b/widget/nsClipboardHelper.cpp
@@ -92,18 +92,17 @@ nsClipboardHelper::CopyStringToClipboard
 
   // qi the data object an |nsISupports| so that when the transferable holds
   // onto it, it will addref the correct interface.
   nsCOMPtr<nsISupports> genericData(do_QueryInterface(data, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(genericData, NS_ERROR_FAILURE);
 
   // set the transfer data
-  rv = trans->SetTransferData(kUnicodeMime, genericData,
-                              aString.Length() * 2);
+  rv = trans->SetTransferData(kUnicodeMime, genericData);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // put the transferable on the clipboard
   rv = clipboard->SetData(trans, nullptr, aClipboardID);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
--- a/widget/nsClipboardProxy.cpp
+++ b/widget/nsClipboardProxy.cpp
@@ -62,46 +62,44 @@ nsClipboardProxy::GetData(nsITransferabl
       nsCOMPtr<nsISupportsString> dataWrapper =
         do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       const nsString& data = item.data().get_nsString();
       rv = dataWrapper->SetData(data);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper,
-                                          data.Length() * sizeof(char16_t));
+      rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper);
       NS_ENSURE_SUCCESS(rv, rv);
     } else if (item.data().type() == IPCDataTransferData::TShmem) {
       // If this is an image, convert it into an nsIInputStream.
       const nsCString& flavor = item.flavor();
       mozilla::ipc::Shmem data = item.data().get_Shmem();
       if (flavor.EqualsLiteral(kJPEGImageMime) ||
           flavor.EqualsLiteral(kJPGImageMime) ||
           flavor.EqualsLiteral(kPNGImageMime) ||
           flavor.EqualsLiteral(kGIFImageMime)) {
         nsCOMPtr<nsIInputStream> stream;
 
         NS_NewCStringInputStream(getter_AddRefs(stream),
                                  nsDependentCSubstring(data.get<char>(), data.Size<char>()));
 
-        rv = aTransferable->SetTransferData(flavor.get(), stream, sizeof(nsISupports*));
+        rv = aTransferable->SetTransferData(flavor.get(), stream);
         NS_ENSURE_SUCCESS(rv, rv);
       } else if (flavor.EqualsLiteral(kNativeHTMLMime) ||
                  flavor.EqualsLiteral(kRTFMime) ||
                  flavor.EqualsLiteral(kCustomTypesMime)) {
         nsCOMPtr<nsISupportsCString> dataWrapper =
           do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
         NS_ENSURE_SUCCESS(rv, rv);
 
         rv = dataWrapper->SetData(nsDependentCSubstring(data.get<char>(), data.Size<char>()));
         NS_ENSURE_SUCCESS(rv, rv);
 
-        rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper,
-                                            data.Size<char>());
+        rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       mozilla::Unused << ContentChild::GetSingleton()->DeallocShmem(data);
     }
   }
 
   return NS_OK;
--- a/widget/nsITransferable.idl
+++ b/widget/nsITransferable.idl
@@ -158,17 +158,17 @@ interface nsITransferable : nsISupports
     * Sets the data in the transferable with the specified flavor. The transferable
     * will maintain its own copy the data, so it is not necessary to do that beforehand.
     *
     * @param  aFlavor the flavor of data that is being set
     * @param  aData the data, either some variant of class in nsISupportsPrimitives.idl,
     *         an nsIFile, or an nsIFlavorDataProvider (see above)
     * @param  aDataLen the length of the data, or 0 if passing a nsIFlavorDataProvider
     */
-  void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
+  void setTransferData(in string aFlavor, in nsISupports aData);
 
   /**
     * Add the data flavor, indicating that this transferable 
     * can receive this type of flavor
     *
     * @param  aDataFlavor a new data flavor to handle
     */
   void addDataFlavor ( in string aDataFlavor ) ;
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -352,54 +352,53 @@ nsTransferable::GetAnyTransferData(nsACS
 
 //
 // SetTransferData
 //
 //
 //
 NS_IMETHODIMP
 nsTransferable::SetTransferData(const char* aFlavor,
-                                nsISupports* aData,
-                                uint32_t aDataLen)
+                                nsISupports* aData)
 {
   MOZ_ASSERT(mInitialized);
 
   // first check our intrinsic flavors to see if one has been registered.
   if (Maybe<size_t> index = FindDataFlavor(aFlavor)) {
     DataStruct& data = mDataArray.ElementAt(index.value());
-    data.SetData(aData, aDataLen, mPrivateData);
+    data.SetData(aData, 0, mPrivateData);
     return NS_OK;
   }
 
   // if not, try using a format converter to find a flavor to put the data in
   if (mFormatConv) {
     for (size_t i = 0; i < mDataArray.Length(); ++i) {
       DataStruct& data = mDataArray.ElementAt(i);
       bool canConvert = false;
       mFormatConv->CanConvert(aFlavor, data.GetFlavor().get(), &canConvert);
 
       if (canConvert) {
         nsCOMPtr<nsISupports> ConvertedData;
         uint32_t ConvertedLen;
         mFormatConv->Convert(aFlavor,
                              aData,
-                             aDataLen,
+                             0,
                              data.GetFlavor().get(),
                              getter_AddRefs(ConvertedData),
                              &ConvertedLen);
         data.SetData(ConvertedData, ConvertedLen, mPrivateData);
         return NS_OK;
       }
     }
   }
 
   // Can't set data neither directly nor through converter. Just add this flavor
   // and try again
   if (NS_SUCCEEDED(AddDataFlavor(aFlavor))) {
-    return SetTransferData(aFlavor, aData, aDataLen);
+    return SetTransferData(aFlavor, aData);
   }
 
   return NS_ERROR_FAILURE;
 }
 
 //
 // AddDataFlavor
 //
--- a/widget/tests/test_bug565392.html
+++ b/widget/tests/test_bug565392.html
@@ -28,17 +28,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   function getLoadContext() {
     return window.docShell.QueryInterface(Ci.nsILoadContext);
   }
 
   function getTransferableFile(file) {
     var transferable = Cc['@mozilla.org/widget/transferable;1']
                          .createInstance(Ci.nsITransferable);
     transferable.init(getLoadContext());
-    transferable.setTransferData("application/x-moz-file", file, 0);
+    transferable.setTransferData("application/x-moz-file", file);
     return transferable;
   }
 
   function setClipboardData(transferable) {
     clipboard.setData(transferable, null, 1);
   }
   
   function getClipboardData(mime) {
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -725,17 +725,17 @@ nsresult nsClipboard::GetDataFromDataObj
           }
         }
 
         nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper));
         free(data);
       }
       
       NS_ASSERTION ( genericDataWrapper, "About to put null data into the transferable" );
-      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLen);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
       res = NS_OK;
 
       // we found one, get out of the loop
       break;
     }
   } // foreach flavor
 
   return res;