Bug 1493292 - Remove aDataLen parameters from nsITransferable.getTransferData. r=smaug
authorTom Schuster <evilpies@gmail.com>
Tue, 20 Nov 2018 16:59:56 +0000
changeset 503685 a58e50deefdc260cef3514c1552e4355ea5a6024
parent 503684 29b3f0dfc6bb418b73a9cd519241b4ec38d0efbc
child 503686 7e2c0177115a4620627a9c15027e960116c0c394
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 aDataLen parameters from nsITransferable.getTransferData. r=smaug Depends on D11200 Differential Revision: https://phabricator.services.mozilla.com/D11201
accessible/tests/mochitest/common.js
browser/base/content/browser.js
browser/base/content/test/urlbar/browser_page_action_menu_clipboard.js
browser/components/places/content/controller.js
browser/extensions/mortar/host/common/ppapi-runtime.jsm
devtools/client/webconsole/test/mochitest/browser_jsterm_screenshot_command_clipboard.js
devtools/shared/platform/clipboard.js
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentUtils.cpp
dom/base/test/copypaste.js
dom/base/test/test_bug166235.html
dom/base/test/test_copyimage.html
dom/events/DataTransferItem.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/TextEditorDataTransfer.cpp
editor/libeditor/tests/test_CF_HTML_clipboard.html
testing/specialpowers/content/specialpowersAPI.js
toolkit/modules/Finder.jsm
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/headless/tests/test_headless_clipboard.js
widget/nsITransferable.idl
widget/nsTransferable.cpp
widget/tests/test_bug466599.xul
widget/tests/test_bug565392.html
widget/tests/test_clipboard.xul
widget/tests/test_transferable_overflow.xul
widget/windows/nsDataObj.cpp
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -726,23 +726,22 @@ function getTextFromClipboard() {
   trans.init(getLoadContext());
   if (!trans)
     return "";
 
   trans.addDataFlavor("text/unicode");
   Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);
 
   var str = {};
-  var strLength = {};
-  trans.getTransferData("text/unicode", str, strLength);
+  trans.getTransferData("text/unicode", str);
 
   if (str)
     str = str.value.QueryInterface(Ci.nsISupportsString);
   if (str)
-    return str.data.substring(0, strLength.value / 2);
+    return str.data;
 
   return "";
 }
 
 /**
  * Extract DOMNode id from an accessible. If e10s is enabled, DOMNode is not
  * present in parent process but, if available, DOMNode id is attached to an
  * accessible object.
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2499,22 +2499,21 @@ function readFromClipboard() {
 
     // If available, use selection clipboard, otherwise global one
     if (Services.clipboard.supportsSelectionClipboard())
       Services.clipboard.getData(trans, Services.clipboard.kSelectionClipboard);
     else
       Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);
 
     var data = {};
-    var dataLen = {};
-    trans.getTransferData("text/unicode", data, dataLen);
+    trans.getTransferData("text/unicode", data);
 
     if (data) {
       data = data.value.QueryInterface(Ci.nsISupportsString);
-      url = data.data.substring(0, dataLen.value / 2);
+      url = data.data;
     }
   } catch (ex) {
   }
 
   return url;
 }
 
 /**
--- a/browser/base/content/test/urlbar/browser_page_action_menu_clipboard.js
+++ b/browser/base/content/test/urlbar/browser_page_action_menu_clipboard.js
@@ -23,14 +23,14 @@ add_task(async function copyURL() {
     // Check the clipboard.
     let transferable = Cc["@mozilla.org/widget/transferable;1"]
                          .createInstance(Ci.nsITransferable);
     transferable.init(null);
     let flavor = "text/unicode";
     transferable.addDataFlavor(flavor);
     Services.clipboard.getData(transferable, Services.clipboard.kGlobalClipboard);
     let strObj = {};
-    transferable.getTransferData(flavor, strObj, {});
+    transferable.getTransferData(flavor, strObj);
     Assert.ok(!!strObj.value);
     strObj.value.QueryInterface(Ci.nsISupportsString);
     Assert.equal(strObj.value.data, gBrowser.selectedBrowser.currentURI.spec);
   });
 });
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -960,17 +960,17 @@ PlacesController.prototype = {
     let action = {};
     let actionOwner;
     try {
       let xferable = Cc["@mozilla.org/widget/transferable;1"].
                      createInstance(Ci.nsITransferable);
       xferable.init(null);
       xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION);
       this.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
-      xferable.getTransferData(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION, action, {});
+      xferable.getTransferData(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION, action);
       [action, actionOwner] =
         action.value.QueryInterface(Ci.nsISupportsString).data.split(",");
     } catch (ex) {
       // Paste from external sources don't have any associated action, just
       // fallback to a copy action.
       return "copy";
     }
     // For cuts also check who inited the action, since cuts across different
--- a/browser/extensions/mortar/host/common/ppapi-runtime.jsm
+++ b/browser/extensions/mortar/host/common/ppapi-runtime.jsm
@@ -2613,18 +2613,17 @@ dump(`callFromJSON: < ${JSON.stringify(c
             PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT) {
           let trans = Cc["@mozilla.org/widget/transferable;1"]
             .createInstance(Ci.nsITransferable);
           trans.init(null)
           trans.addDataFlavor("text/unicode");
           Services.clipboard.getData(
             trans, Services.clipboard.kGlobalClipboard);
           let str = {};
-          let strLength = {};
-          trans.getTransferData("text/unicode", str, strLength);
+          trans.getTransferData("text/unicode", str);
           let pasteText = str.value.QueryInterface(Ci.nsISupportsString).data;
           return new String_PP_Var(pasteText);
         }
       }
       return new PP_Var();
     },
 
     /**
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_screenshot_command_clipboard.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_screenshot_command_clipboard.js
@@ -160,21 +160,19 @@ async function getImageSizeFromClipboard
   const trans = Cc["@mozilla.org/widget/transferable;1"]
                 .createInstance(Ci.nsITransferable);
   const flavor = "image/png";
   trans.init(null);
   trans.addDataFlavor(flavor);
 
   clip.getData(trans, clipid.kGlobalClipboard);
   const data = {};
-  const dataLength = {};
-  trans.getTransferData(flavor, data, dataLength);
+  trans.getTransferData(flavor, data);
 
   ok(data.value, "screenshot exists");
-  ok(dataLength.value > 0, "screenshot has length");
 
   let image = data.value;
 
   // Due to the differences in how images could be stored in the clipboard the
   // checks below are needed. The clipboard could already provide the image as
   // byte streams or as image container. If it's not possible obtain a
   // byte stream, the function throws.
 
--- a/devtools/shared/platform/clipboard.js
+++ b/devtools/shared/platform/clipboard.js
@@ -37,17 +37,17 @@ function getText() {
   // Get the data into our transferable.
   Services.clipboard.getData(
     xferable,
     Services.clipboard.kGlobalClipboard
   );
 
   const data = {};
   try {
-    xferable.getTransferData(flavor, data, {});
+    xferable.getTransferData(flavor, data);
   } catch (e) {
     // Clipboard doesn't contain data in flavor, return null.
     return null;
   }
 
   // There's no data available, return.
   if (!data.value) {
     return null;
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -238,35 +238,33 @@ nsContentAreaDragDropDataProvider::GetFl
   *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;
-    uint32_t dataSize = 0;
-    aTransferable->GetTransferData(kFilePromiseURLMime,
-                                   getter_AddRefs(tmp), &dataSize);
+    aTransferable->GetTransferData(kFilePromiseURLMime, getter_AddRefs(tmp));
     nsCOMPtr<nsISupportsString> supportsString =
       do_QueryInterface(tmp);
     if (!supportsString)
       return NS_ERROR_FAILURE;
 
     nsAutoString sourceURLString;
     supportsString->GetData(sourceURLString);
     if (sourceURLString.IsEmpty())
       return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIURI> sourceURI;
     rv = NS_NewURI(getter_AddRefs(sourceURI), sourceURLString);
     NS_ENSURE_SUCCESS(rv, rv);
 
     aTransferable->GetTransferData(kFilePromiseDestFilename,
-                                   getter_AddRefs(tmp), &dataSize);
+                                   getter_AddRefs(tmp));
     supportsString = do_QueryInterface(tmp);
     if (!supportsString)
       return NS_ERROR_FAILURE;
 
     nsAutoString targetFilename;
     supportsString->GetData(targetFilename);
     if (targetFilename.IsEmpty())
       return NS_ERROR_FAILURE;
@@ -275,17 +273,17 @@ nsContentAreaDragDropDataProvider::GetFl
     // Use the image request's MIME type to ensure the filename's
     // extension is compatible with the OS's handler for this type.
     // If it isn't, or is missing, replace the extension with the
     // primary extension. On Mac, do this in the parent process
     // because sandboxing blocks access to MIME-handler info from
     // content processes.
     if (XRE_IsParentProcess()) {
       aTransferable->GetTransferData(kImageRequestMime,
-                                     getter_AddRefs(tmp), &dataSize);
+                                     getter_AddRefs(tmp));
       supportsString = do_QueryInterface(tmp);
       if (!supportsString)
         return NS_ERROR_FAILURE;
 
       nsAutoString imageRequestMime;
       supportsString->GetData(imageRequestMime);
 
       // If we have a MIME type, check the extension is compatible
@@ -323,19 +321,18 @@ nsContentAreaDragDropDataProvider::GetFl
     // make the filename safe for the filesystem
     targetFilename.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS,
                                '-');
 #endif /* defined(XP_MACOSX) */
 
     // get the target directory from the kFilePromiseDirectoryMime
     // flavor
     nsCOMPtr<nsISupports> dirPrimitive;
-    dataSize = 0;
     aTransferable->GetTransferData(kFilePromiseDirectoryMime,
-                                   getter_AddRefs(dirPrimitive), &dataSize);
+                                   getter_AddRefs(dirPrimitive));
     nsCOMPtr<nsIFile> destDirectory = do_QueryInterface(dirPrimitive);
     if (!destDirectory)
       return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIFile> file;
     rv = destDirectory->Clone(getter_AddRefs(file));
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -789,37 +786,32 @@ DragDataProducer::Produce(DataTransfer* 
     else {
       rv = nsCopySupport::GetTransferableForNode(nodeToSerialize, doc,
                                                  getter_AddRefs(transferable));
     }
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsISupports> supports;
     nsCOMPtr<nsISupportsString> data;
-    uint32_t dataSize;
-    rv = transferable->GetTransferData(kHTMLMime, getter_AddRefs(supports),
-                                       &dataSize);
+    rv = transferable->GetTransferData(kHTMLMime, getter_AddRefs(supports));
     data = do_QueryInterface(supports);
     if (NS_SUCCEEDED(rv)) {
       data->GetData(mHtmlString);
     }
-    rv = transferable->GetTransferData(kHTMLContext, getter_AddRefs(supports),
-                                       &dataSize);
+    rv = transferable->GetTransferData(kHTMLContext, getter_AddRefs(supports));
     data = do_QueryInterface(supports);
     if (NS_SUCCEEDED(rv)) {
       data->GetData(mContextString);
     }
-    rv = transferable->GetTransferData(kHTMLInfo, getter_AddRefs(supports),
-                                       &dataSize);
+    rv = transferable->GetTransferData(kHTMLInfo, getter_AddRefs(supports));
     data = do_QueryInterface(supports);
     if (NS_SUCCEEDED(rv)) {
       data->GetData(mInfoString);
     }
-    rv = transferable->GetTransferData(kUnicodeMime, getter_AddRefs(supports),
-                                       &dataSize);
+    rv = transferable->GetTransferData(kUnicodeMime, getter_AddRefs(supports));
     data = do_QueryInterface(supports);
     NS_ENSURE_SUCCESS(rv, rv); // require plain text at a minimum
     data->GetData(mTitleString);
   }
 
   // default text value is the URL
   if (mTitleString.IsEmpty()) {
     mTitleString = mUrlString;
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7989,18 +7989,17 @@ nsContentUtils::TransferableToIPCTransfe
 
     for (uint32_t j = 0; j < flavorList.Length(); ++j) {
       nsCString& flavorStr = flavorList[j];
       if (!flavorStr.Length()) {
         continue;
       }
 
       nsCOMPtr<nsISupports> data;
-      uint32_t dataLen = 0;
-      aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(data), &dataLen);
+      aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(data));
 
       nsCOMPtr<nsISupportsString> text = do_QueryInterface(data);
       nsCOMPtr<nsISupportsCString> ctext = do_QueryInterface(data);
       if (text) {
         nsAutoString dataAsString;
         text->GetData(dataAsString);
         IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
         item->flavor() = flavorStr;
--- a/dom/base/test/copypaste.js
+++ b/dom/base/test/copypaste.js
@@ -80,17 +80,17 @@ async function testCopyPaste (isXHTML) {
   }
   function getClipboardData(mime) {
     var transferable = SpecialPowers.Cc['@mozilla.org/widget/transferable;1']
                                     .createInstance(SpecialPowers.Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = SpecialPowers.createBlankObject();
-    transferable.getTransferData(mime, data, {}) ;
+    transferable.getTransferData(mime, data) ;
     return data;
   }
   function testHtmlClipboardValue(mime, expected) {
     // For Windows, navigator.platform returns "Win32".
     var expectedValue = expected;
     if (navigator.platform.includes("Win")) {
       // Windows has extra content.
       var expectedValue = "<html><body>\n<!--StartFragment-->" +
--- a/dom/base/test/test_bug166235.html
+++ b/dom/base/test/test_bug166235.html
@@ -55,17 +55,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   }
   function getClipboardData(mime) {
     var transferable = Cc['@mozilla.org/widget/transferable;1']
                          .createInstance(SpecialPowers.Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = SpecialPowers.createBlankObject();
-    transferable.getTransferData(mime, data, {}) ;
+    transferable.getTransferData(mime, data) ;
     return SpecialPowers.wrap(data);
   }
   function testHtmlClipboardValue(mime, expected, test) {
     var expectedValue = expected;
     // For Windows, navigator.platform returns "Win32".
     if (navigator.platform.includes("Win")) {
       expectedValue = "<html><body>\n<!--StartFragment-->" + expected + "<!--EndFragment-->\n</body>\n</html>";
     }
--- a/dom/base/test/test_copyimage.html
+++ b/dom/base/test/test_copyimage.html
@@ -27,17 +27,17 @@ function testCopyImage () {
     var transferable = Cc['@mozilla.org/widget/transferable;1']
                        .createInstance(Ci.nsITransferable);
     var loadingContext = SpecialPowers.wrap(window).docShell
                                       .QueryInterface(Ci.nsILoadContext);
     transferable.init(loadingContext);
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = SpecialPowers.createBlankObject();
-    transferable.getTransferData(mime, data, {});
+    transferable.getTransferData(mime, data);
     return data;
   }
 
   function testClipboardValue(mime, expected) {
     var data = SpecialPowers.wrap(getClipboardData(mime));
     var str = data.value == null ? data.value :
               data.value.QueryInterface(Ci.nsISupportsString).data;
     is(str, expected, "clipboard has correct [" + mime + "] content")
--- a/dom/events/DataTransferItem.cpp
+++ b/dom/events/DataTransferItem.cpp
@@ -174,19 +174,18 @@ DataTransferItem::FillInExternalData()
     }
 
     nsresult rv = dragSession->GetData(trans, mIndex);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
     }
   }
 
-  uint32_t length = 0;
   nsCOMPtr<nsISupports> data;
-  nsresult rv = trans->GetTransferData(format, getter_AddRefs(data), &length);
+  nsresult rv = trans->GetTransferData(format, getter_AddRefs(data));
   if (NS_WARN_IF(NS_FAILED(rv) || !data)) {
     return;
   }
 
   // Fill the variant
   RefPtr<nsVariantCC> variant = new nsVariantCC();
 
   eKind oldKind = Kind();
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -1580,57 +1580,48 @@ HTMLEditor::PasteInternal(int32_t aClipb
   // also get additional html copy hints, if present
   nsAutoString contextStr, infoStr;
 
   // If we have our internal html flavor on the clipboard, there is special
   // context to use instead of cfhtml context.
   bool bHavePrivateHTMLFlavor = HavePrivateHTMLFlavor(clipboard);
   if (bHavePrivateHTMLFlavor) {
     nsCOMPtr<nsISupports> contextDataObj, infoDataObj;
-    uint32_t contextLen, infoLen;
     nsCOMPtr<nsISupportsString> textDataObj;
 
     nsCOMPtr<nsITransferable> contextTransferable =
       do_CreateInstance("@mozilla.org/widget/transferable;1");
     if (NS_WARN_IF(!contextTransferable)) {
       return NS_ERROR_FAILURE;
     }
     contextTransferable->Init(nullptr);
     contextTransferable->AddDataFlavor(kHTMLContext);
     clipboard->GetData(contextTransferable, aClipboardType);
     contextTransferable->GetTransferData(kHTMLContext,
-                                         getter_AddRefs(contextDataObj),
-                                         &contextLen);
+                                         getter_AddRefs(contextDataObj));
 
     nsCOMPtr<nsITransferable> infoTransferable =
       do_CreateInstance("@mozilla.org/widget/transferable;1");
     if (NS_WARN_IF(!infoTransferable)) {
       return NS_ERROR_FAILURE;
     }
     infoTransferable->Init(nullptr);
     infoTransferable->AddDataFlavor(kHTMLInfo);
     clipboard->GetData(infoTransferable, aClipboardType);
     infoTransferable->GetTransferData(kHTMLInfo,
-                                      getter_AddRefs(infoDataObj),
-                                      &infoLen);
+                                      getter_AddRefs(infoDataObj));
 
     if (contextDataObj) {
-      nsAutoString text;
       textDataObj = do_QueryInterface(contextDataObj);
-      textDataObj->GetData(text);
-      MOZ_ASSERT(text.Length() <= contextLen / 2);
-      contextStr.Assign(text.get(), contextLen / 2);
+      textDataObj->GetData(contextStr);
     }
 
     if (infoDataObj) {
-      nsAutoString text;
       textDataObj = do_QueryInterface(infoDataObj);
-      textDataObj->GetData(text);
-      MOZ_ASSERT(text.Length() <= infoLen / 2);
-      infoStr.Assign(text.get(), infoLen / 2);
+      textDataObj->GetData(infoStr);
     }
   }
 
   rv = InsertFromTransferable(transferable, nullptr, contextStr, infoStr,
                               bHavePrivateHTMLFlavor, true);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -1789,20 +1780,18 @@ HTMLEditor::CanPasteTransferable(nsITran
     length = ArrayLength(textEditorFlavors);
   } else {
     flavors = textHtmlEditorFlavors;
     length = ArrayLength(textHtmlEditorFlavors);
   }
 
   for (size_t i = 0; i < length; i++, flavors++) {
     nsCOMPtr<nsISupports> data;
-    uint32_t dataLen;
     nsresult rv = aTransferable->GetTransferData(*flavors,
-                                                 getter_AddRefs(data),
-                                                 &dataLen);
+                                                 getter_AddRefs(data));
     if (NS_SUCCEEDED(rv) && data) {
       return true;
     }
   }
 
   return false;
 }
 
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -460,20 +460,18 @@ TextEditor::CanPasteTransferable(nsITran
   }
 
   // If |aTransferable| is null, assume that a paste will succeed.
   if (!aTransferable) {
     return true;
   }
 
   nsCOMPtr<nsISupports> data;
-  uint32_t dataLen;
   nsresult rv = aTransferable->GetTransferData(kUnicodeMime,
-                                               getter_AddRefs(data),
-                                               &dataLen);
+                                               getter_AddRefs(data));
   if (NS_SUCCEEDED(rv) && data) {
     return true;
   }
 
   return false;
 }
 
 bool
--- a/editor/libeditor/tests/test_CF_HTML_clipboard.html
+++ b/editor/libeditor/tests/test_CF_HTML_clipboard.html
@@ -50,17 +50,17 @@ function copyCF_HTML(cfhtml, success, fa
 
     var trans = Cc["@mozilla.org/widget/transferable;1"].
                 createInstance(Ci.nsITransferable);
     trans.init(getLoadContext());
     trans.addDataFlavor(CF_HTML);
     cb.getData(trans, cb.kGlobalClipboard);
     var data = SpecialPowers.createBlankObject();
     try {
-      trans.getTransferData(CF_HTML, data, {});
+      trans.getTransferData(CF_HTML, data);
       data = SpecialPowers.wrap(data).value.QueryInterface(Ci.nsISupportsCString).data;
     } catch (e) {
       setTimeout(function() { copyCF_HTML_worker(successFn, failureFn); }, 100);
       return;
     }
     success();
   }
 
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1789,17 +1789,17 @@ SpecialPowersAPI.prototype = {
     // for some non-e10s mochi tests, |window| is null whereas |content.window|
     // works fine.  So we take whatever is non-null!
     xferable.init(this._getDocShell(typeof(window) == "undefined" ? this.mm.content.window : window)
                       .QueryInterface(Ci.nsILoadContext));
     xferable.addDataFlavor(flavor);
     Services.clipboard.getData(xferable, whichClipboard);
     var data = {};
     try {
-      xferable.getTransferData(flavor, data, {});
+      xferable.getTransferData(flavor, data);
     } catch (e) {}
     data = data.value || null;
     if (data == null)
       return "";
 
     return data.QueryInterface(Ci.nsISupportsString).data;
   },
 
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -606,18 +606,17 @@ function GetClipboardSearchString(aLoadC
     let trans = Cc["@mozilla.org/widget/transferable;1"]
                   .createInstance(Ci.nsITransferable);
     trans.init(aLoadContext);
     trans.addDataFlavor("text/unicode");
 
     Clipboard.getData(trans, Ci.nsIClipboard.kFindClipboard);
 
     let data = {};
-    let dataLen = {};
-    trans.getTransferData("text/unicode", data, dataLen);
+    trans.getTransferData("text/unicode", data);
     if (data.value) {
       data = data.value.QueryInterface(Ci.nsISupportsString);
       searchString = data.toString();
     }
   } catch (ex) {}
 
   return searchString;
 }
--- a/widget/android/nsClipboard.cpp
+++ b/widget/android/nsClipboard.cpp
@@ -28,19 +28,17 @@ nsClipboard::nsClipboard()
 NS_IMETHODIMP
 nsClipboard::SetData(nsITransferable *aTransferable,
                      nsIClipboardOwner *anOwner, int32_t aWhichClipboard)
 {
   if (aWhichClipboard != kGlobalClipboard)
     return NS_ERROR_NOT_IMPLEMENTED;
 
   nsCOMPtr<nsISupports> tmp;
-  uint32_t len;
-  nsresult rv  = aTransferable->GetTransferData(kUnicodeMime, getter_AddRefs(tmp),
-                                                &len);
+  nsresult rv  = aTransferable->GetTransferData(kUnicodeMime, getter_AddRefs(tmp));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsISupportsString> supportsString = do_QueryInterface(tmp);
   // No support for non-text data
   NS_ENSURE_TRUE(supportsString, NS_ERROR_NOT_IMPLEMENTED);
   nsAutoString buffer;
   supportsString->GetData(buffer);
 
   java::Clipboard::SetText(java::GeckoAppShell::GetApplicationContext(),
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -6252,19 +6252,18 @@ provideDataForType:(NSString*)aType
           }
 
           item->SetTransferData(kFilePromiseDirectoryMime, macLocalFile,
                                 sizeof(nsIFile*));
 
           // Now request the kFilePromiseMime data, which will invoke the data
           // provider. If successful, the file will have been created.
           nsCOMPtr<nsISupports> fileDataPrimitive;
-          uint32_t dataSize = 0;
           item->GetTransferData(kFilePromiseMime,
-                                getter_AddRefs(fileDataPrimitive), &dataSize);
+                                getter_AddRefs(fileDataPrimitive));
         }
         CFRelease(urlRef);
         CFRelease(pboardRef);
 
         [aPasteboard setPropertyList:[pasteboardOutputDict valueForKey:curType]
                              forType:curType];
       }
     }
--- a/widget/cocoa/nsClipboard.mm
+++ b/widget/cocoa/nsClipboard.mm
@@ -384,20 +384,19 @@ nsClipboard::GetNativeClipboardData(nsIT
   // transferable. Otherwise clear it because it isn't relevant any more.
   if (mCachedClipboard == aWhichClipboard &&
       mChangeCount == [cocoaPasteboard changeCount]) {
     if (mTransferable) {
       for (uint32_t i = 0; i < flavors.Length(); i++) {
         nsCString& flavorStr = flavors[i];
 
         nsCOMPtr<nsISupports> dataSupports;
-        uint32_t dataSize = 0;
-        rv = mTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports), &dataSize);
+        rv = mTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports));
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr.get(), dataSupports, dataSize);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports, 0);
           return NS_OK; // maybe try to fill in more types? Is there a point?
         }
       }
     }
   } else {
     EmptyClipboard(aWhichClipboard);
   }
 
@@ -512,19 +511,18 @@ nsClipboard::PasteboardDictFromTransfera
   for (uint32_t i = 0; i < flavors.Length(); i++) {
     nsCString& flavorStr = flavors[i];
 
     MOZ_LOG(sCocoaLog, LogLevel::Info, ("writing out clipboard data of type %s (%d)\n", flavorStr.get(), i));
 
     NSString *pboardType = nil;
 
     if (nsClipboard::IsStringType(flavorStr, &pboardType)) {
-      uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> genericDataWrapper;
-      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper), &dataSize);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper));
       if (NS_FAILED(rv)) {
         [pboardType release];
         continue;
       }
 
       nsAutoString data;
       if (nsCOMPtr<nsISupportsString> text = do_QueryInterface(genericDataWrapper)) {
         text->GetData(data);
@@ -537,19 +535,18 @@ nsClipboard::PasteboardDictFromTransfera
         nativeString = [NSString string];
 
       // be nice to Carbon apps, normalize the receiver's contents using Form C.
       nativeString = [nativeString precomposedStringWithCanonicalMapping];
 
       [pasteboardOutputDict setObject:nativeString forKey:pboardType];
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
-      uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> genericDataWrapper;
-      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper), &dataSize);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper));
       if (NS_FAILED(rv)) {
         continue;
       }
 
       nsAutoCString data;
       if (nsCOMPtr<nsISupportsCString> text = do_QueryInterface(genericDataWrapper)) {
         text->GetData(data);
       }
@@ -559,19 +556,18 @@ nsClipboard::PasteboardDictFromTransfera
         NSString* customType =
           [UTIHelper stringFromPboardType:kMozCustomTypesPboardType];
         [pasteboardOutputDict setObject:nativeData forKey:customType];
       }
     }
     else if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
              flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime) ||
              flavorStr.EqualsLiteral(kNativeImageMime)) {
-      uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> transferSupports;
-      aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(transferSupports), &dataSize);
+      aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(transferSupports));
 
       nsCOMPtr<imgIContainer> image(do_QueryInterface(transferSupports));
       if (!image) {
         NS_WARNING("Image isn't an imgIContainer in transferable");
         continue;
       }
 
       RefPtr<SourceSurface> surface =
@@ -608,19 +604,18 @@ nsClipboard::PasteboardDictFromTransfera
       NSString* tiffType =
         [UTIHelper stringFromPboardType:NSPasteboardTypeTIFF];
       [pasteboardOutputDict setObject:(NSMutableData*)tiffData
                                forKey:tiffType];
       if (tiffData)
         CFRelease(tiffData);
     }
     else if (flavorStr.EqualsLiteral(kFileMime)) {
-      uint32_t len = 0;
       nsCOMPtr<nsISupports> genericFile;
-      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericFile), &len);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericFile));
       if (NS_FAILED(rv)) {
         continue;
       }
 
       nsCOMPtr<nsIFile> file(do_QueryInterface(genericFile));
       if (!file) {
         continue;
       }
@@ -646,35 +641,34 @@ nsClipboard::PasteboardDictFromTransfera
         [UTIHelper stringFromPboardType:
           (NSString*)kPasteboardTypeFilePromiseContent];
       [pasteboardOutputDict setObject:[NSArray arrayWithObject:@""]
                                forKey:urlPromise];
       [pasteboardOutputDict setObject:[NSArray arrayWithObject:@""]
                                forKey:urlPromiseContent];
     }
     else if (flavorStr.EqualsLiteral(kURLMime)) {
-      uint32_t len = 0;
       nsCOMPtr<nsISupports> genericURL;
-      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericURL), &len);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericURL));
       nsCOMPtr<nsISupportsString> urlObject(do_QueryInterface(genericURL));
 
       nsAutoString url;
       urlObject->GetData(url);
 
       NSString* nativeTitle = nil;
 
       // A newline embedded in the URL means that the form is actually URL +
       // title. This embedding occurs in nsDragService::GetData.
       int32_t newlinePos = url.FindChar(char16_t('\n'));
       if (newlinePos >= 0) {
         url.Truncate(newlinePos);
 
         nsAutoString urlTitle;
         urlObject->GetData(urlTitle);
-        urlTitle.Mid(urlTitle, newlinePos + 1, len - (newlinePos + 1));
+        urlTitle.Mid(urlTitle, newlinePos + 1, urlTitle.Length() - (newlinePos + 1));
 
         nativeTitle =
           [NSString stringWithCharacters:
             reinterpret_cast<const unichar*>(urlTitle.get())
                                   length:urlTitle.Length()];
       }
       // The Finder doesn't like getting random binary data aka
       // Unicode, so change it into an escaped URL containing only
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -388,20 +388,19 @@ nsDragService::GetData(nsITransferable* 
   // when the drag started if possible
   if (mDataItems) {
     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;
-        uint32_t dataSize = 0;
-        rv = currentTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports), &dataSize);
+        rv = currentTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports));
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr.get(), dataSupports, dataSize);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports, 0);
           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++) {
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -470,27 +470,25 @@ nsClipboard::SelectionGetEvent(GtkClipbo
       printf("nsClipboard::SelectionGetEvent() - %s clipboard is empty!\n",
              whichClipboard == kSelectionClipboard ? "Selection" : "Global");
 #endif
       return;
     }
 
     nsresult rv;
     nsCOMPtr<nsISupports> item;
-    uint32_t len;
 
     GdkAtom selectionTarget = gtk_selection_data_get_target(aSelectionData);
 
     // Check to see if the selection data is some text type.
     if (gtk_targets_include_text(&selectionTarget, 1)) {
         // Try to convert our internal type into a text string.  Get
         // the transferable for this clipboard and try to get the
         // text/unicode type for it.
-        rv = trans->GetTransferData("text/unicode", getter_AddRefs(item),
-                                    &len);
+        rv = trans->GetTransferData("text/unicode", getter_AddRefs(item));
         if (!item || NS_FAILED(rv))
             return;
 
         nsCOMPtr<nsISupportsString> wideString;
         wideString = do_QueryInterface(item);
         if (!wideString)
             return;
 
@@ -506,17 +504,21 @@ nsClipboard::SelectionGetEvent(GtkClipbo
     // Check to see if the selection data is an image type
     if (gtk_targets_include_image(&selectionTarget, 1, TRUE)) {
         // Look through our transfer data for the image
         static const char* const imageMimeTypes[] = {
             kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime, kGIFImageMime };
         nsCOMPtr<nsISupports> imageItem;
         nsCOMPtr<imgIContainer> image;
         for (uint32_t i = 0; i < ArrayLength(imageMimeTypes); i++) {
-            rv = trans->GetTransferData(imageMimeTypes[i], getter_AddRefs(imageItem), &len);
+            rv = trans->GetTransferData(imageMimeTypes[i], getter_AddRefs(imageItem));
+            if (NS_FAILED(rv)) {
+              continue;
+            }
+
             image = do_QueryInterface(imageItem);
             if (image) {
                 break;
             }
         }
 
         if (!image) { // Not getting an image for an image mime type!?
             return;
@@ -527,17 +529,17 @@ nsClipboard::SelectionGetEvent(GtkClipbo
             return;
 
         gtk_selection_data_set_pixbuf(aSelectionData, pixbuf);
         g_object_unref(pixbuf);
         return;
     }
 
     if (selectionTarget == gdk_atom_intern(kHTMLMime, FALSE)) {
-        rv = trans->GetTransferData(kHTMLMime, getter_AddRefs(item), &len);
+        rv = trans->GetTransferData(kHTMLMime, getter_AddRefs(item));
         if (!item || NS_FAILED(rv)) {
             return;
         }
 
         nsCOMPtr<nsISupportsString> wideString;
         wideString = do_QueryInterface(item);
         if (!wideString) {
             return;
@@ -557,17 +559,17 @@ nsClipboard::SelectionGetEvent(GtkClipbo
     }
 
     // Try to match up the selection data target to something our
     // transferable provides.
     gchar *target_name = gdk_atom_name(selectionTarget);
     if (!target_name)
         return;
 
-    rv = trans->GetTransferData(target_name, getter_AddRefs(item), &len);
+    rv = trans->GetTransferData(target_name, getter_AddRefs(item));
     // nothing found?
     if (!item || NS_FAILED(rv)) {
         g_free(target_name);
         return;
     }
 
     void *primitive_data = nullptr;
     uint32_t dataLen = 0;
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -704,30 +704,27 @@ nsDragService::GetData(nsITransferable *
                    ("flavor is %s\n", flavorStr.get()));
             // get the item with the right index
             nsCOMPtr<nsITransferable> item =
                 do_QueryElementAt(mSourceDataItems, aItemIndex);
             if (!item)
                 continue;
 
             nsCOMPtr<nsISupports> data;
-            uint32_t tmpDataLen = 0;
             MOZ_LOG(sDragLm, LogLevel::Debug,
                    ("trying to get transfer data for %s\n",
                    flavorStr.get()));
             rv = item->GetTransferData(flavorStr.get(),
-                                       getter_AddRefs(data),
-                                       &tmpDataLen);
+                                       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,
-                                                tmpDataLen);
+            rv = aTransferable->SetTransferData(flavorStr.get(), data, 0);
             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;
@@ -1485,19 +1482,17 @@ CreateURIList(nsIArray* aItems, nsACStri
 
     for (uint32_t i = 0; i < length; ++i) {
         nsCOMPtr<nsITransferable> item = do_QueryElementAt(aItems, i);
         if (!item) {
             continue;
         }
 
         nsCOMPtr<nsISupports> data;
-        uint32_t len = 0;
-        nsresult rv = item->GetTransferData(kURLMime, getter_AddRefs(data),
-                                            &len);
+        nsresult rv = item->GetTransferData(kURLMime, getter_AddRefs(data));
         if (NS_SUCCEEDED(rv)) {
             nsCOMPtr<nsISupportsString> string = do_QueryInterface(data);
 
             nsAutoString text;
             if (string) {
                 string->GetData(text);
             }
 
@@ -1510,17 +1505,17 @@ CreateURIList(nsIArray* aItems, nsACStri
 
             AppendUTF16toUTF8(text, aURIList);
             aURIList.AppendLiteral("\r\n");
             continue;
         }
 
         // There is no URI available. If there is a file available, create
         // a URI from the file.
-        rv = item->GetTransferData(kFileMime, getter_AddRefs(data), &len);
+        rv = item->GetTransferData(kFileMime, getter_AddRefs(data));
         if (NS_SUCCEEDED(rv)) {
             if (nsCOMPtr<nsIFile> file = do_QueryInterface(data)) {
                 nsCOMPtr<nsIURI> fileURI;
                 NS_NewFileURI(getter_AddRefs(fileURI), file);
                 if (fileURI) {
                     nsAutoCString spec;
                     fileURI->GetSpec(spec);
 
@@ -1672,20 +1667,18 @@ nsDragService::SourceDataGet(GtkWidget  
 
             // Request a different type in GetTransferData.
             actualFlavor = kFilePromiseMime;
         } else {
             actualFlavor = mimeFlavor.get();
         }
         nsresult rv;
         nsCOMPtr<nsISupports> data;
-        uint32_t len;
         rv = item->GetTransferData(actualFlavor,
-                                   getter_AddRefs(data),
-                                   &len);
+                                   getter_AddRefs(data));
 
         if (strcmp(actualFlavor, kFilePromiseMime) == 0) {
             if (NS_SUCCEEDED(rv)) {
                 // Indicate success.
                 gtk_selection_data_set(aSelectionData, target, 8,
                                        (guchar *)"S", 1);
             }
             return;
@@ -1745,19 +1738,18 @@ nsDragService::SourceBeginDrag(GdkDragCo
 
     nsTArray<nsCString> flavors;
     nsresult rv = transferable->FlavorsTransferableCanImport(flavors);
     NS_ENSURE_SUCCESS(rv,);
 
     for (uint32_t i = 0; i < flavors.Length(); ++i) {
         if (flavors[i].EqualsLiteral(kFilePromiseDestFilename)) {
             nsCOMPtr<nsISupports> data;
-            uint32_t dataSize = 0;
             transferable->GetTransferData(kFilePromiseDestFilename,
-                                          getter_AddRefs(data), &dataSize);
+                                          getter_AddRefs(data));
             nsCOMPtr<nsISupportsString> fileName = do_QueryInterface(data);
             if (!fileName)
                 return;
 
             nsAutoString fileNameStr;
             fileName->GetData(fileNameStr);
 
             nsCString fileNameCStr;
--- a/widget/headless/HeadlessClipboard.cpp
+++ b/widget/headless/HeadlessClipboard.cpp
@@ -27,20 +27,18 @@ HeadlessClipboard::SetData(nsITransferab
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // Clear out the clipboard in order to set the new data.
   EmptyClipboard(aWhichClipboard);
 
   // Only support plain text for now.
   nsCOMPtr<nsISupports> clip;
-  uint32_t len;
   nsresult rv = aTransferable->GetTransferData(kUnicodeMime,
-                                               getter_AddRefs(clip),
-                                               &len);
+                                               getter_AddRefs(clip));
   if (NS_FAILED(rv)) {
     return rv;
   }
   nsCOMPtr<nsISupportsString> wideString = do_QueryInterface(clip);
   if (!wideString) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
   nsAutoString utf16string;
--- a/widget/headless/tests/test_headless_clipboard.js
+++ b/widget/headless/tests/test_headless_clipboard.js
@@ -11,22 +11,21 @@ function getString(clipboard) {
                         .createInstance(Ci.nsITransferable);
   trans.init(null);
   trans.addDataFlavor("text/unicode");
 
   clipboard.getData(trans, Ci.nsIClipboard.kGlobalClipboard);
 
   try {
     var data = {};
-    var dataLen = {};
-    trans.getTransferData("text/unicode", data, dataLen);
+    trans.getTransferData("text/unicode", data);
 
     if (data) {
       data = data.value.QueryInterface(Ci.nsISupportsString);
-      str = data.data.substring(0, dataLen.value / 2);
+      str = data.data;
     }
   } catch (ex) {
     // If the clipboard is empty getTransferData will throw.
   }
 
   return str;
 }
 
--- a/widget/nsITransferable.idl
+++ b/widget/nsITransferable.idl
@@ -127,17 +127,17 @@ interface nsITransferable : nsISupports
 
   /**
     * Given a flavor retrieve the data. 
     *
     * @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 getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
+  void getTransferData(in string aFlavor, out nsISupports aData);
 
   /**
     * Returns the best flavor in the transferable, given those that have
     * been added to it with |AddFlavor()|
     *
     * @param  aFlavor (out parameter) the flavor of data that was retrieved
     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
     */
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -255,23 +255,21 @@ nsTransferable::FindDataFlavor(const cha
 // GetTransferData
 //
 // Returns the data of the requested flavor, obtained from either having the
 // data on hand or using a converter to get it. The data is wrapped in a
 // nsISupports primitive so that it is accessible from JS.
 //
 NS_IMETHODIMP
 nsTransferable::GetTransferData(const char* aFlavor,
-                                nsISupports** aData,
-                                uint32_t* aDataLen)
+                                nsISupports** aData)
 {
   MOZ_ASSERT(mInitialized);
 
   *aData = nullptr;
-  *aDataLen = 0;
 
   nsresult rv = NS_OK;
 
   // 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;
     uint32_t len;
     mDataArray[index.value()].GetData(getter_AddRefs(dataBytes), &len);
@@ -283,17 +281,16 @@ nsTransferable::GetTransferData(const ch
                                        getter_AddRefs(dataBytes), &len);
       if (NS_FAILED(rv)) {
         dataBytes = nullptr;
         // The provider failed, fall into the converter code below.
       }
     }
 
     if (dataBytes) {
-      *aDataLen = len;
       dataBytes.forget(aData);
       return NS_OK;
     }
 
     // Empty data
   }
 
   // If not, try using a format converter to get the requested flavor.
@@ -313,18 +310,19 @@ nsTransferable::GetTransferData(const ch
           rv = dataProvider->GetFlavorData(this, aFlavor,
                                            getter_AddRefs(dataBytes), &len);
           if (NS_FAILED(rv)) {
             // Give up.
             return rv;
           }
         }
 
+        uint32_t dataLen;
         return mFormatConv->Convert(data.GetFlavor().get(), dataBytes, len,
-                                    aFlavor, aData, aDataLen);
+                                    aFlavor, aData, &dataLen);
       }
     }
   }
 
   return NS_ERROR_FAILURE;
 }
 
 //
--- a/widget/tests/test_bug466599.xul
+++ b/widget/tests/test_bug466599.xul
@@ -61,22 +61,21 @@ function readFromClipboard()
   var trans =
     Cc['@mozilla.org/widget/transferable;1'].createInstance(Ci.nsITransferable);
   if (!trans)
     return;
   trans.init(getLoadContext());
   trans.addDataFlavor('text/html');
   clip.getData(trans,clipid.kGlobalClipboard);
   var str = new Object();
-  var strLength = new Object();
-  trans.getTransferData("text/html",str,strLength);
+  trans.getTransferData("text/html",str);
   if (str)
     str = str.value.QueryInterface(Ci.nsISupportsString);
   if (str)
-    pastetext = str.data.substring(0,strLength.value / 2);
+    pastetext = str.data;
   return pastetext;
 }
 
 function encodeHtmlEntities(s)
 {
   var result = '';
   for (var i = 0; i < s.length; i++) {
     var c = s.charAt(i);
--- a/widget/tests/test_bug565392.html
+++ b/widget/tests/test_bug565392.html
@@ -43,17 +43,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   
   function getClipboardData(mime) {
     var transferable = Cc['@mozilla.org/widget/transferable;1']
                          .createInstance(Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = {};
-    transferable.getTransferData(mime, data, {}) ;
+    transferable.getTransferData(mime, data);
     return data;
   }
 
 setClipboardData(getTransferableFile(dir1))
 is(clipboard.hasDataMatchingFlavors(["application/x-moz-file"], 1,1), true);
 var data = getClipboardData("application/x-moz-file");
 var file = data.value.QueryInterface(Ci.nsIFile);
 ok(file.isDirectory(), true);
--- a/widget/tests/test_clipboard.xul
+++ b/widget/tests/test_clipboard.xul
@@ -32,26 +32,25 @@ https://bugzilla.mozilla.org/show_bug.cg
   // Get clipboard data to paste.
   function paste(clipboard) {
     let trans = Cc['@mozilla.org/widget/transferable;1']
                 .createInstance(Ci.nsITransferable);
     trans.init(getLoadContext());
     trans.addDataFlavor("text/unicode");
     clipboard.getData(trans, Ci.nsIClipboard.kGlobalClipboard);
     let str = {};
-    let length = {};
     try {
-      trans.getTransferData('text/unicode', str, length);
+      trans.getTransferData('text/unicode', str);
     } catch (e) {
       str = '';
     }
     if (str) {
       str = str.value.QueryInterface(Ci.nsISupportsString);
       if (str) {
-        str = str.data.substring(0, length.value / 2);
+        str = str.data;
       }
     }
     return str;
   }
 
   function initAndRunTests() {
     let clipboard = Cc['@mozilla.org/widget/clipboard;1']
                     .getService(Ci.nsIClipboard);
--- a/widget/tests/test_transferable_overflow.xul
+++ b/widget/tests/test_transferable_overflow.xul
@@ -25,23 +25,21 @@
   function assignTextToTransferable(transferable, string) {
     var Suppstr = nsSupportsString();
     Suppstr.data = string;
     transferable.setTransferData("text/unicode", Suppstr, string.length * 2);
   }
 
   function checkTransferableText(transferable, expectedString, description) {
     var data = {};
-    var dataLen = {};
-    transferable.getTransferData("text/unicode", data, dataLen);
+    transferable.getTransferData("text/unicode", data);
     var actualValue = data.value.QueryInterface(Ci.nsISupportsString).data;
     // Use ok + shortenString instead of is(...) to avoid dumping millions of characters in the output.
     ok(actualValue === expectedString, description + ": text should match. " +
        "Expected " + shortenString(expectedString)  + ", got " + shortenString(actualValue));
-    is(dataLen.value, expectedString.length * 2, description + ": text length should match");
 
     function shortenString(str) {
       return str && str.length > 30 ? str.slice(0, 10) + "..." + str.slice(-10) : String(str);
     }
   }
 
   function isFDCountingSupported() {
     // On on-Windows we can count the number of file handles for the current process,
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -893,19 +893,18 @@ HRESULT nsDataObj::AddGetFormat(FORMATET
 // imgIContainer, so just QI it.
 //
 HRESULT 
 nsDataObj::GetDib(const nsACString& inFlavor,
                   FORMATETC &aFormat,
                   STGMEDIUM & aSTG)
 {
   ULONG result = E_FAIL;
-  uint32_t len = 0;
   nsCOMPtr<nsISupports> genericDataWrapper;
-  mTransferable->GetTransferData(PromiseFlatCString(inFlavor).get(), getter_AddRefs(genericDataWrapper), &len);
+  mTransferable->GetTransferData(PromiseFlatCString(inFlavor).get(), getter_AddRefs(genericDataWrapper));
   nsCOMPtr<imgIContainer> image ( do_QueryInterface(genericDataWrapper) );
   if ( image ) {
     nsCOMPtr<imgITools> imgTools = do_CreateInstance("@mozilla.org/image/tools;1");
 
     nsAutoString options;
     if (aFormat.cfFormat == CF_DIBV5) {
       options.AppendLiteral("version=5");
     } else {
@@ -1359,31 +1358,32 @@ HRESULT nsDataObj::GetPreferredDropEffec
   aSTG.hGlobal = hGlobalMemory;
   return res;
 }
 
 //-----------------------------------------------------
 HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   void* data = nullptr;
-  uint32_t   len;
   
   // if someone asks for text/plain, look up text/unicode instead in the transferable.
   const char* flavorStr;
   const nsPromiseFlatCString& flat = PromiseFlatCString(aDataFlavor);
   if (aDataFlavor.EqualsLiteral("text/plain"))
     flavorStr = kUnicodeMime;
   else
     flavorStr = flat.get();
 
   // NOTE: CreateDataFromPrimitive creates new memory, that needs to be deleted
   nsCOMPtr<nsISupports> genericDataWrapper;
-  mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &len);
-  if ( !len )
+  mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper));
+  if ( !genericDataWrapper )
     return E_FAIL;
+
+  uint32_t   len;
   nsPrimitiveHelpers::CreateDataFromPrimitive(
     nsDependentCString(flavorStr), genericDataWrapper, &data, &len);
   if ( !data )
     return E_FAIL;
 
   HGLOBAL     hGlobalMemory = nullptr;
 
   aSTG.tymed          = TYMED_HGLOBAL;
@@ -1477,21 +1477,19 @@ HRESULT nsDataObj::GetFile(FORMATETC& aF
       dfInx++;
   }
   return E_FAIL;
 }
 
 HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   nsresult rv;
-  uint32_t len = 0;
   nsCOMPtr<nsISupports> genericDataWrapper;
 
-  mTransferable->GetTransferData(kFileMime, getter_AddRefs(genericDataWrapper),
-                                 &len);
+  mTransferable->GetTransferData(kFileMime, getter_AddRefs(genericDataWrapper));
   nsCOMPtr<nsIFile> file ( do_QueryInterface(genericDataWrapper) );
   if (!file)
     return E_FAIL;
 
   aSTG.tymed = TYMED_HGLOBAL;
   aSTG.pUnkForRelease = nullptr;
 
   nsAutoString path;
@@ -1532,20 +1530,19 @@ HRESULT nsDataObj::DropFile(FORMATETC& a
 
   return S_OK;
 }
 
 HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   nsresult rv;
   if (!mCachedTempFile) {
-    uint32_t len = 0;
     nsCOMPtr<nsISupports> genericDataWrapper;
 
-    mTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper), &len);
+    mTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper));
     nsCOMPtr<imgIContainer> image(do_QueryInterface(genericDataWrapper));
     if (!image) 
       return E_FAIL;
 
     nsCOMPtr<imgITools> imgTools = do_CreateInstance("@mozilla.org/image/tools;1");
     nsCOMPtr<nsIInputStream> inputStream;
     rv = imgTools->EncodeImage(image, NS_LITERAL_CSTRING(IMAGE_BMP),
                                NS_LITERAL_STRING("version=3"),
@@ -1836,36 +1833,35 @@ void nsDataObj::SetTransferable(nsITrans
 //   <url> <linefeed> <page title>
 //
 nsresult
 nsDataObj :: ExtractShortcutURL ( nsString & outURL )
 {
   NS_ASSERTION ( mTransferable, "We don't have a good transferable" );
   nsresult rv = NS_ERROR_FAILURE;
   
-  uint32_t len = 0;
   nsCOMPtr<nsISupports> genericURL;
-  if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL), &len)) ) {
+  if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL)))) {
     nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
     if ( urlObject ) {
       nsAutoString url;
       urlObject->GetData ( url );
       outURL = url;
 
       // find the first linefeed in the data, that's where the url ends. trunc the 
       // result string at that point.
       int32_t lineIndex = outURL.FindChar ( '\n' );
       NS_ASSERTION ( lineIndex > 0, "Format for url flavor is <url> <linefeed> <page title>" );
       if ( lineIndex > 0 ) {
         outURL.Truncate ( lineIndex );
         rv = NS_OK;    
       }
     }
-  } else if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLDataMime, getter_AddRefs(genericURL), &len)) ||
-              NS_SUCCEEDED(mTransferable->GetTransferData(kURLPrivateMime, getter_AddRefs(genericURL), &len)) ) {
+  } else if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLDataMime, getter_AddRefs(genericURL))) ||
+              NS_SUCCEEDED(mTransferable->GetTransferData(kURLPrivateMime, getter_AddRefs(genericURL))) ) {
     nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
     if ( urlObject ) {
       nsAutoString url;
       urlObject->GetData ( url );
       outURL = url;
 
       rv = NS_OK;    
     }
@@ -1887,30 +1883,29 @@ nsDataObj :: ExtractShortcutURL ( nsStri
 //   <url> <linefeed> <page title>
 //
 nsresult
 nsDataObj :: ExtractShortcutTitle ( nsString & outTitle )
 {
   NS_ASSERTION ( mTransferable, "We'd don't have a good transferable" );
   nsresult rv = NS_ERROR_FAILURE;
   
-  uint32_t len = 0;
   nsCOMPtr<nsISupports> genericURL;
-  if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL), &len)) ) {
+  if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL)) )) {
     nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
     if ( urlObject ) {
       nsAutoString url;
       urlObject->GetData ( url );
 
       // find the first linefeed in the data, that's where the url ends. we want
       // everything after that linefeed. FindChar() returns -1 if we can't find
       int32_t lineIndex = url.FindChar ( '\n' );
       NS_ASSERTION ( lineIndex != -1, "Format for url flavor is <url> <linefeed> <page title>" );
       if ( lineIndex != -1 ) {
-        url.Mid ( outTitle, lineIndex + 1, (len/2) - (lineIndex + 1) );
+        url.Mid ( outTitle, lineIndex + 1, url.Length() - (lineIndex + 1) );
         rv = NS_OK;    
       }
     }
   } // if found flavor
   
   return rv;
 
 } // ExtractShortcutTitle
@@ -2096,31 +2091,30 @@ HRESULT nsDataObj::GetDownloadDetails(ns
                                       nsAString &aFilename)
 {
   *aSourceURI = nullptr;
 
   NS_ENSURE_TRUE(mTransferable, E_FAIL);
 
   // get the URI from the kFilePromiseURLMime flavor
   nsCOMPtr<nsISupports> urlPrimitive;
-  uint32_t dataSize = 0;
-  mTransferable->GetTransferData(kFilePromiseURLMime, getter_AddRefs(urlPrimitive), &dataSize);
+  mTransferable->GetTransferData(kFilePromiseURLMime, getter_AddRefs(urlPrimitive));
   nsCOMPtr<nsISupportsString> srcUrlPrimitive = do_QueryInterface(urlPrimitive);
   NS_ENSURE_TRUE(srcUrlPrimitive, E_FAIL);
   
   nsAutoString srcUri;
   srcUrlPrimitive->GetData(srcUri);
   if (srcUri.IsEmpty())
     return E_FAIL;
   nsCOMPtr<nsIURI> sourceURI;
   NS_NewURI(getter_AddRefs(sourceURI), srcUri);
 
   nsAutoString srcFileName;
   nsCOMPtr<nsISupports> fileNamePrimitive;
-  mTransferable->GetTransferData(kFilePromiseDestFilename, getter_AddRefs(fileNamePrimitive), &dataSize);
+  mTransferable->GetTransferData(kFilePromiseDestFilename, getter_AddRefs(fileNamePrimitive));
   nsCOMPtr<nsISupportsString> srcFileNamePrimitive = do_QueryInterface(fileNamePrimitive);
   if (srcFileNamePrimitive) {
     srcFileNamePrimitive->GetData(srcFileName);
   } else {
     nsCOMPtr<nsIURL> sourceURL = do_QueryInterface(sourceURI);
     if (!sourceURL)
       return E_FAIL;