summaryrefslogtreecommitdiffstats
path: root/widget/nsClipboardProxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'widget/nsClipboardProxy.cpp')
-rw-r--r--widget/nsClipboardProxy.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/widget/nsClipboardProxy.cpp b/widget/nsClipboardProxy.cpp
index 3b27d5954d..5855374566 100644
--- a/widget/nsClipboardProxy.cpp
+++ b/widget/nsClipboardProxy.cpp
@@ -32,7 +32,8 @@ nsClipboardProxy::nsClipboardProxy() : mClipboardCaps(false, false, false) {}
NS_IMETHODIMP
nsClipboardProxy::SetData(nsITransferable* aTransferable,
- nsIClipboardOwner* anOwner, int32_t aWhichClipboard) {
+ nsIClipboardOwner* anOwner, int32_t aWhichClipboard,
+ mozilla::dom::WindowContext* aWindowContext) {
#if defined(ACCESSIBILITY) && defined(XP_WIN)
a11y::Compatibility::SuppressA11yForClipboardCopy();
#endif
@@ -41,17 +42,19 @@ nsClipboardProxy::SetData(nsITransferable* aTransferable,
IPCTransferable ipcTransferable;
nsContentUtils::TransferableToIPCTransferable(aTransferable, &ipcTransferable,
false, nullptr);
- child->SendSetClipboard(std::move(ipcTransferable), aWhichClipboard);
+ child->SendSetClipboard(std::move(ipcTransferable), aWhichClipboard,
+ aWindowContext);
return NS_OK;
}
NS_IMETHODIMP nsClipboardProxy::AsyncSetData(
- int32_t aWhichClipboard, nsIAsyncClipboardRequestCallback* aCallback,
+ int32_t aWhichClipboard, mozilla::dom::WindowContext* aSettingWindowContext,
+ nsIAsyncClipboardRequestCallback* aCallback,
nsIAsyncSetClipboardData** _retval) {
RefPtr<ClipboardWriteRequestChild> request =
MakeRefPtr<ClipboardWriteRequestChild>(aCallback);
ContentChild::GetSingleton()->SendPClipboardWriteRequestConstructor(
- request, aWhichClipboard);
+ request, aWhichClipboard, aSettingWindowContext);
request.forget(_retval);
return NS_OK;
}
@@ -69,12 +72,18 @@ nsClipboardProxy::GetData(nsITransferable* aTransferable,
nsTArray<nsCString> types;
aTransferable->FlavorsTransferableCanImport(types);
- IPCTransferableData transferable;
- ContentChild::GetSingleton()->SendGetClipboard(types, aWhichClipboard,
- aWindowContext, &transferable);
+ IPCTransferableDataOrError transferableOrError;
+ ContentChild::GetSingleton()->SendGetClipboard(
+ types, aWhichClipboard, aWindowContext, &transferableOrError);
+
+ if (transferableOrError.type() == IPCTransferableDataOrError::Tnsresult) {
+ MOZ_ASSERT(NS_FAILED(transferableOrError.get_nsresult()));
+ return transferableOrError.get_nsresult();
+ }
+
return nsContentUtils::IPCTransferableDataToTransferable(
- transferable, false /* aAddDataFlavor */, aTransferable,
- false /* aFilterUnknownFlavors */);
+ transferableOrError.get_IPCTransferableData(), false /* aAddDataFlavor */,
+ aTransferable, false /* aFilterUnknownFlavors */);
}
namespace {