Bug 1755481: rename nsIClipboard::getData to nsIClipboard::getSomeData and document it. r=mccr8
Before, it was confusing. One could have assumed that the method gets the data for all flavors. Differential Revision: https://phabricator.services.mozilla.com/D138776
This commit is contained in:
@@ -162,7 +162,8 @@ void DataTransferItem::FillInExternalData() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = clipboard->GetData(trans, mDataTransfer->ClipboardType());
|
nsresult rv =
|
||||||
|
clipboard->GetSomeData(trans, mDataTransfer->ClipboardType());
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3319,7 +3319,7 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboard(
|
|||||||
trans->AddDataFlavor(aTypes[t].get());
|
trans->AddDataFlavor(aTypes[t].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard->GetData(trans, aWhichClipboard);
|
clipboard->GetSomeData(trans, aWhichClipboard);
|
||||||
nsContentUtils::TransferableToIPCTransferable(trans, aDataTransfer, true,
|
nsContentUtils::TransferableToIPCTransferable(trans, aDataTransfer, true,
|
||||||
nullptr, this);
|
nullptr, this);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
|
|||||||
@@ -2093,9 +2093,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
// Get the Data from the clipboard
|
// Get the Data from the clipboard
|
||||||
rv = clipboard->GetData(transferable, aClipboardType);
|
rv = clipboard->GetSomeData(transferable, aClipboardType);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("nsIClipboard::GetData() failed");
|
NS_WARNING("nsIClipboard::GetSomeData() failed");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2126,9 +2126,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
|||||||
NS_WARNING_ASSERTION(
|
NS_WARNING_ASSERTION(
|
||||||
NS_SUCCEEDED(rvIgnored),
|
NS_SUCCEEDED(rvIgnored),
|
||||||
"nsITransferable::AddDataFlavor(kHTMLContext) failed, but ignored");
|
"nsITransferable::AddDataFlavor(kHTMLContext) failed, but ignored");
|
||||||
rvIgnored = clipboard->GetData(contextTransferable, aClipboardType);
|
rvIgnored = clipboard->GetSomeData(contextTransferable, aClipboardType);
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||||
"nsIClipboard::GetData() failed, but ignored");
|
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||||
nsCOMPtr<nsISupports> contextDataObj;
|
nsCOMPtr<nsISupports> contextDataObj;
|
||||||
rv = contextTransferable->GetTransferData(kHTMLContext,
|
rv = contextTransferable->GetTransferData(kHTMLContext,
|
||||||
getter_AddRefs(contextDataObj));
|
getter_AddRefs(contextDataObj));
|
||||||
@@ -2156,9 +2156,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
|||||||
NS_WARNING_ASSERTION(
|
NS_WARNING_ASSERTION(
|
||||||
NS_SUCCEEDED(rvIgnored),
|
NS_SUCCEEDED(rvIgnored),
|
||||||
"nsITransferable::AddDataFlavor(kHTMLInfo) failed, but ignored");
|
"nsITransferable::AddDataFlavor(kHTMLInfo) failed, but ignored");
|
||||||
clipboard->GetData(infoTransferable, aClipboardType);
|
clipboard->GetSomeData(infoTransferable, aClipboardType);
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||||
"nsIClipboard::GetData() failed, but ignored");
|
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||||
nsCOMPtr<nsISupports> infoDataObj;
|
nsCOMPtr<nsISupports> infoDataObj;
|
||||||
rv = infoTransferable->GetTransferData(kHTMLInfo,
|
rv = infoTransferable->GetTransferData(kHTMLInfo,
|
||||||
getter_AddRefs(infoDataObj));
|
getter_AddRefs(infoDataObj));
|
||||||
@@ -2288,9 +2288,9 @@ nsresult HTMLEditor::PasteNoFormattingAsAction(int32_t aSelectionType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the Data from the clipboard
|
// Get the Data from the clipboard
|
||||||
rv = clipboard->GetData(transferable, aSelectionType);
|
rv = clipboard->GetSomeData(transferable, aSelectionType);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("nsIClipboard::GetData() failed");
|
NS_WARNING("nsIClipboard::GetSomeData() failed");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2543,9 +2543,9 @@ nsresult HTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType) {
|
|||||||
"nsITransferable::AddDataFlavor(kUnicodeMime) failed, but ignored");
|
"nsITransferable::AddDataFlavor(kUnicodeMime) failed, but ignored");
|
||||||
|
|
||||||
// Get the Data from the clipboard
|
// Get the Data from the clipboard
|
||||||
rvIgnored = clipboard->GetData(transferable, aSelectionType);
|
rvIgnored = clipboard->GetSomeData(transferable, aSelectionType);
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||||
"nsIClipboard::GetData() failed, but ignored");
|
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||||
|
|
||||||
// Now we ask the transferable for the data
|
// Now we ask the transferable for the data
|
||||||
// it still owns the data, we just have a pointer to it.
|
// it still owns the data, we just have a pointer to it.
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ nsresult TextEditor::PasteAsQuotationAsAction(int32_t aClipboardType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the Data from the clipboard
|
// Get the Data from the clipboard
|
||||||
clipboard->GetData(trans, aClipboardType);
|
clipboard->GetSomeData(trans, aClipboardType);
|
||||||
|
|
||||||
// Now we ask the transferable for the data
|
// Now we ask the transferable for the data
|
||||||
// it still owns the data, we just have a pointer to it.
|
// it still owns the data, we just have a pointer to it.
|
||||||
|
|||||||
@@ -206,9 +206,9 @@ nsresult TextEditor::PasteAsAction(int32_t aClipboardType,
|
|||||||
return NS_OK; // XXX Why?
|
return NS_OK; // XXX Why?
|
||||||
}
|
}
|
||||||
// Get the Data from the clipboard.
|
// Get the Data from the clipboard.
|
||||||
rv = clipboard->GetData(transferable, aClipboardType);
|
rv = clipboard->GetSomeData(transferable, aClipboardType);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("nsIClipboard::GetData() failed, but ignored");
|
NS_WARNING("nsIClipboard::GetSomeData() failed, but ignored");
|
||||||
return NS_OK; // XXX Why?
|
return NS_OK; // XXX Why?
|
||||||
}
|
}
|
||||||
// XXX Why don't we check this first?
|
// XXX Why don't we check this first?
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ nsClipboard::SetData(nsITransferable* aTransferable, nsIClipboardOwner* anOwner,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
nsClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||||
|
int32_t aWhichClipboard) {
|
||||||
if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED;
|
if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
if (!jni::IsAvailable()) {
|
if (!jni::IsAvailable()) {
|
||||||
|
|||||||
@@ -743,7 +743,7 @@ nsClipboard::SetData(nsITransferable* aTransferable, nsIClipboardOwner* anOwner,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
nsClipboard::GetSomeData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
||||||
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
||||||
|
|
||||||
bool selectClipPresent;
|
bool selectClipPresent;
|
||||||
|
|||||||
@@ -420,8 +420,9 @@ bool nsClipboard::FilterImportedFlavors(int32_t aWhichClipboard,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
nsClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||||
LOGCLIP("nsClipboard::GetData (%s)\n",
|
int32_t aWhichClipboard) {
|
||||||
|
LOGCLIP("nsClipboard::GetSomeData (%s)\n",
|
||||||
aWhichClipboard == kSelectionClipboard ? "primary" : "clipboard");
|
aWhichClipboard == kSelectionClipboard ? "primary" : "clipboard");
|
||||||
|
|
||||||
// TODO: Ensure we don't re-enter here.
|
// TODO: Ensure we don't re-enter here.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ HeadlessClipboard::SetData(nsITransferable* aTransferable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HeadlessClipboard::GetData(nsITransferable* aTransferable,
|
HeadlessClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||||
int32_t aWhichClipboard) {
|
int32_t aWhichClipboard) {
|
||||||
if (aWhichClipboard != kGlobalClipboard) {
|
if (aWhichClipboard != kGlobalClipboard) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ NS_IMETHODIMP nsBaseClipboard::SetData(nsITransferable* aTransferable,
|
|||||||
* Gets the transferable object
|
* Gets the transferable object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable* aTransferable,
|
NS_IMETHODIMP nsBaseClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||||
int32_t aWhichClipboard) {
|
int32_t aWhichClipboard) {
|
||||||
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ nsClipboardProxy::SetData(nsITransferable* aTransferable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsClipboardProxy::GetData(nsITransferable* aTransferable,
|
nsClipboardProxy::GetSomeData(nsITransferable* aTransferable,
|
||||||
int32_t aWhichClipboard) {
|
int32_t aWhichClipboard) {
|
||||||
nsTArray<nsCString> types;
|
nsTArray<nsCString> types;
|
||||||
aTransferable->FlavorsTransferableCanImport(types);
|
aTransferable->FlavorsTransferableCanImport(types);
|
||||||
|
|||||||
@@ -33,14 +33,16 @@ interface nsIClipboard : nsISupports
|
|||||||
in long aWhichClipboard ) ;
|
in long aWhichClipboard ) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a transferable, get the clipboard data.
|
* Filters the flavors aTransferable can import (see
|
||||||
|
* `nsITransferable::flavorsTransferableCanImport`) and gets the data for the
|
||||||
|
* first flavor. That data is set for aTransferable.
|
||||||
*
|
*
|
||||||
* @param aTransferable The transferable
|
* @param aTransferable The transferable
|
||||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||||
* @result NS_Ok if no errors
|
* @result NS_OK if no errors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void getData ( in nsITransferable aTransferable, in long aWhichClipboard ) ;
|
void getSomeData ( in nsITransferable aTransferable, in long aWhichClipboard ) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This empties the clipboard and notifies the clipboard owner.
|
* This empties the clipboard and notifies the clipboard owner.
|
||||||
|
|||||||
Reference in New Issue
Block a user