forked from mirrors/gecko-dev
Bug 1690532 - Making the nsITransferable to use a correct cookieJarSettings when doing a Image Copy on Windows. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D176427
This commit is contained in:
parent
a147d2ddf4
commit
58b5467f89
5 changed files with 22 additions and 2 deletions
|
|
@ -641,6 +641,7 @@ static nsresult AppendImagePromise(nsITransferable* aTransferable,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aTransferable->SetRequestingPrincipal(node->NodePrincipal());
|
||||
aTransferable->SetCookieJarSettings(node->OwnerDoc()->CookieJarSettings());
|
||||
aTransferable->SetContentPolicyType(nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||
|
||||
// add the dataless file promise flavor
|
||||
|
|
|
|||
|
|
@ -3466,6 +3466,7 @@ void ContentParent::OnVarChanged(const GfxVarUpdate& aVar) {
|
|||
mozilla::ipc::IPCResult ContentParent::RecvSetClipboard(
|
||||
const IPCDataTransfer& aDataTransfer, const bool& aIsPrivateData,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
mozilla::Maybe<CookieJarSettingsArgs> aCookieJarSettingsArgs,
|
||||
const nsContentPolicyType& aContentPolicyType,
|
||||
nsIReferrerInfo* aReferrerInfo, const int32_t& aWhichClipboard) {
|
||||
// aRequestingPrincipal is allowed to be nullptr here.
|
||||
|
|
@ -3485,6 +3486,13 @@ mozilla::ipc::IPCResult ContentParent::RecvSetClipboard(
|
|||
trans->Init(nullptr);
|
||||
trans->SetReferrerInfo(aReferrerInfo);
|
||||
|
||||
if (aCookieJarSettingsArgs.isSome()) {
|
||||
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||
net::CookieJarSettings::Deserialize(aCookieJarSettingsArgs.ref(),
|
||||
getter_AddRefs(cookieJarSettings));
|
||||
trans->SetCookieJarSettings(cookieJarSettings);
|
||||
}
|
||||
|
||||
rv = nsContentUtils::IPCTransferableToTransferable(
|
||||
aDataTransfer, aIsPrivateData, aRequestingPrincipal, aContentPolicyType,
|
||||
true /* aAddDataFlavor */, trans, true /* aFilterUnknownFlavors */);
|
||||
|
|
|
|||
|
|
@ -996,6 +996,7 @@ class ContentParent final : public PContentParent,
|
|||
mozilla::ipc::IPCResult RecvSetClipboard(
|
||||
const IPCDataTransfer& aDataTransfer, const bool& aIsPrivateData,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
mozilla::Maybe<CookieJarSettingsArgs> aCookieJarSettingsArgs,
|
||||
const nsContentPolicyType& aContentPolicyType,
|
||||
nsIReferrerInfo* aReferrerInfo, const int32_t& aWhichClipboard);
|
||||
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,7 @@ parent:
|
|||
async SetClipboard(IPCDataTransfer aDataTransfer,
|
||||
bool aIsPrivateData,
|
||||
nullable nsIPrincipal aRequestingPrincipal,
|
||||
CookieJarSettingsArgs? cookieJarSettings,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
nullable nsIReferrerInfo aReferrerInfo,
|
||||
int32_t aWhichClipboard);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
# include "mozilla/a11y/Compatibility.h"
|
||||
#endif
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/net/CookieJarSettings.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsClipboardProxy.h"
|
||||
|
|
@ -36,14 +38,21 @@ nsClipboardProxy::SetData(nsITransferable* aTransferable,
|
|||
nsContentUtils::TransferableToIPCTransferable(aTransferable, &ipcDataTransfer,
|
||||
false, nullptr);
|
||||
|
||||
Maybe<mozilla::net::CookieJarSettingsArgs> cookieJarSettingsArgs;
|
||||
if (nsCOMPtr<nsICookieJarSettings> cookieJarSettings =
|
||||
aTransferable->GetCookieJarSettings()) {
|
||||
mozilla::net::CookieJarSettingsArgs args;
|
||||
mozilla::net::CookieJarSettings::Cast(cookieJarSettings)->Serialize(args);
|
||||
cookieJarSettingsArgs = Some(args);
|
||||
}
|
||||
bool isPrivateData = aTransferable->GetIsPrivateData();
|
||||
nsCOMPtr<nsIPrincipal> requestingPrincipal =
|
||||
aTransferable->GetRequestingPrincipal();
|
||||
nsContentPolicyType contentPolicyType = aTransferable->GetContentPolicyType();
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = aTransferable->GetReferrerInfo();
|
||||
child->SendSetClipboard(std::move(ipcDataTransfer), isPrivateData,
|
||||
requestingPrincipal, contentPolicyType, referrerInfo,
|
||||
aWhichClipboard);
|
||||
requestingPrincipal, cookieJarSettingsArgs,
|
||||
contentPolicyType, referrerInfo, aWhichClipboard);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue