зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1493292 - Remove aDataLen parameters from nsITransferable.setTransferData. r=smaug
Depends on D11201 Differential Revision: https://phabricator.services.mozilla.com/D11202 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b292ec7c2c
Коммит
8be0fec340
|
@ -7755,8 +7755,7 @@ nsContentUtils::IPCTransferableToTransferable(const IPCDataTransfer& aDataTransf
|
|||
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) {
|
||||
|
@ -7766,7 +7765,7 @@ nsContentUtils::IPCTransferableToTransferable(const IPCDataTransfer& aDataTransf
|
|||
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);
|
||||
|
@ -7779,7 +7778,7 @@ nsContentUtils::IPCTransferableToTransferable(const IPCDataTransfer& aDataTransf
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -415,8 +415,7 @@ nsCopySupport::ImageCopy(nsIImageLoadingContent* aImageElement,
|
|||
#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);
|
||||
}
|
||||
|
||||
|
@ -454,8 +453,7 @@ static nsresult AppendString(nsITransferable *aTransferable,
|
|||
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,
|
||||
|
|
|
@ -1076,8 +1076,7 @@ DataTransfer::GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext)
|
|||
strSupports->SetData(str);
|
||||
|
||||
nsresult rv = transferable->SetTransferData(kCustomTypesMime,
|
||||
strSupports,
|
||||
totalCustomLength);
|
||||
strSupports);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1117,8 +1116,7 @@ DataTransfer::GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext)
|
|||
continue;
|
||||
}
|
||||
|
||||
nsresult rv = transferable->SetTransferData(format, convertedData,
|
||||
lengthInBytes);
|
||||
nsresult rv = transferable->SetTransferData(format, convertedData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
|
|||
|
||||
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;
|
||||
|
|
|
@ -6251,8 +6251,7 @@ provideDataForType:(NSString*)aType
|
|||
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.
|
||||
|
|
|
@ -239,7 +239,7 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb
|
|||
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;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb
|
|||
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) ||
|
||||
|
@ -336,7 +336,7 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb
|
|||
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)
|
||||
|
@ -391,7 +391,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable* aTransferable, int32_t aWhi
|
|||
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?
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
|||
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?
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
|||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
aTransferable->SetTransferData(flavorStr.get(), file, dataLength);
|
||||
aTransferable->SetTransferData(flavorStr.get(), file);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
|||
nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
|
||||
getter_AddRefs(genericDataWrapper));
|
||||
|
||||
aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, sizeof(nsIInputStream*));
|
||||
aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
|
||||
free(clipboardDataPtr);
|
||||
break;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -236,8 +236,7 @@ nsClipboard::SetTransferableData(nsITransferable* aTransferable,
|
|||
aClipboardData,
|
||||
aClipboardDataLength,
|
||||
getter_AddRefs(wrapper));
|
||||
aTransferable->SetTransferData(aFlavor.get(),
|
||||
wrapper, aClipboardDataLength);
|
||||
aTransferable->SetTransferData(aFlavor.get(), wrapper);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -278,8 +277,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
|
|||
clipboardData,
|
||||
clipboardDataLength,
|
||||
NS_ASSIGNMENT_COPY);
|
||||
aTransferable->SetTransferData(flavorStr.get(), byteStream,
|
||||
sizeof(nsIInputStream*));
|
||||
aTransferable->SetTransferData(flavorStr.get(), byteStream);
|
||||
|
||||
mContext->ReleaseClipboardData(clipboardData);
|
||||
return NS_OK;
|
||||
|
|
|
@ -719,7 +719,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
|
|||
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,
|
||||
|
@ -786,8 +786,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
|
|||
// 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;
|
||||
}
|
||||
|
@ -940,8 +939,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
|
|||
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;
|
||||
|
@ -1650,8 +1648,7 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
|
|||
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);
|
||||
|
@ -1662,8 +1659,7 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
|
|||
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;
|
||||
|
|
|
@ -64,8 +64,7 @@ HeadlessClipboard::GetData(nsITransferable *aTransferable,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -97,8 +97,7 @@ nsClipboardHelper::CopyStringToClipboard(const nsAString& aString,
|
|||
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
|
||||
|
|
|
@ -67,8 +67,7 @@ nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboar
|
|||
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.
|
||||
|
@ -83,7 +82,7 @@ nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboar
|
|||
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) ||
|
||||
|
@ -95,8 +94,7 @@ nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboar
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ interface nsITransferable : nsISupports
|
|||
* 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
|
||||
|
|
|
@ -357,15 +357,14 @@ nsTransferable::GetAnyTransferData(nsACString& aFlavor,
|
|||
//
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -381,7 +380,7 @@ nsTransferable::SetTransferData(const char* aFlavor,
|
|||
uint32_t ConvertedLen;
|
||||
mFormatConv->Convert(aFlavor,
|
||||
aData,
|
||||
aDataLen,
|
||||
0,
|
||||
data.GetFlavor().get(),
|
||||
getter_AddRefs(ConvertedData),
|
||||
&ConvertedLen);
|
||||
|
@ -394,7 +393,7 @@ nsTransferable::SetTransferData(const char* aFlavor,
|
|||
// 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;
|
||||
|
|
|
@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -730,7 +730,7 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject,
|
|||
}
|
||||
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче