From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- widget/nsClipboardProxy.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'widget/nsClipboardProxy.cpp') 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 request = MakeRefPtr(aCallback); ContentChild::GetSingleton()->SendPClipboardWriteRequestConstructor( - request, aWhichClipboard); + request, aWhichClipboard, aSettingWindowContext); request.forget(_retval); return NS_OK; } @@ -69,12 +72,18 @@ nsClipboardProxy::GetData(nsITransferable* aTransferable, nsTArray 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 { -- cgit v1.2.3