зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1641270 - Part 2: Make WebBrowserPersistDocument aware of CookieJarSettings. r=smaug
In this patch, we add cookieJarSettings in WebBrowserPersistDocument. This is needed if we want to use the correct cookieJarSettings when download the page or URI. Differential Revision: https://phabricator.services.mozilla.com/D95612
This commit is contained in:
Родитель
5a9cd22328
Коммит
cc4149ee76
|
@ -12,6 +12,7 @@ include protocol PParentToChildStream; //FIXME: bug #792908
|
||||||
|
|
||||||
include PBackgroundSharedTypes;
|
include PBackgroundSharedTypes;
|
||||||
include IPCStream;
|
include IPCStream;
|
||||||
|
include NeckoChannelParams;
|
||||||
|
|
||||||
using refcounted class nsIReferrerInfo from "mozilla/dom/ReferrerInfoUtils.h";
|
using refcounted class nsIReferrerInfo from "mozilla/dom/ReferrerInfoUtils.h";
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ struct WebBrowserPersistDocumentAttrs {
|
||||||
nsCString characterSet;
|
nsCString characterSet;
|
||||||
nsString title;
|
nsString title;
|
||||||
nsIReferrerInfo referrerInfo;
|
nsIReferrerInfo referrerInfo;
|
||||||
|
CookieJarSettingsArgs cookieJarSettings;
|
||||||
nsString contentDisposition;
|
nsString contentDisposition;
|
||||||
uint32_t sessionHistoryCacheKey;
|
uint32_t sessionHistoryCacheKey;
|
||||||
uint32_t persistFlags;
|
uint32_t persistFlags;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "WebBrowserPersistResourcesChild.h"
|
#include "WebBrowserPersistResourcesChild.h"
|
||||||
#include "WebBrowserPersistSerializeChild.h"
|
#include "WebBrowserPersistSerializeChild.h"
|
||||||
#include "mozilla/StaticPrefs_fission.h"
|
#include "mozilla/StaticPrefs_fission.h"
|
||||||
|
#include "mozilla/net/CookieJarSettings.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ void WebBrowserPersistDocumentChild::Start(
|
||||||
|
|
||||||
nsCOMPtr<nsIPrincipal> principal;
|
nsCOMPtr<nsIPrincipal> principal;
|
||||||
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
||||||
|
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||||
WebBrowserPersistDocumentAttrs attrs;
|
WebBrowserPersistDocumentAttrs attrs;
|
||||||
nsCOMPtr<nsIInputStream> postDataStream;
|
nsCOMPtr<nsIInputStream> postDataStream;
|
||||||
#define ENSURE(e) \
|
#define ENSURE(e) \
|
||||||
|
@ -67,6 +69,10 @@ void WebBrowserPersistDocumentChild::Start(
|
||||||
ENSURE(aDocument->GetReferrerInfo(getter_AddRefs(referrerInfo)));
|
ENSURE(aDocument->GetReferrerInfo(getter_AddRefs(referrerInfo)));
|
||||||
attrs.referrerInfo() = referrerInfo;
|
attrs.referrerInfo() = referrerInfo;
|
||||||
|
|
||||||
|
ENSURE(aDocument->GetCookieJarSettings(getter_AddRefs(cookieJarSettings)));
|
||||||
|
net::CookieJarSettings::Cast(cookieJarSettings)
|
||||||
|
->Serialize(attrs.cookieJarSettings());
|
||||||
|
|
||||||
ENSURE(aDocument->GetPostData(getter_AddRefs(postDataStream)));
|
ENSURE(aDocument->GetPostData(getter_AddRefs(postDataStream)));
|
||||||
#undef ENSURE
|
#undef ENSURE
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,14 @@ WebBrowserPersistLocalDocument::GetReferrerInfo(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebBrowserPersistLocalDocument::GetCookieJarSettings(
|
||||||
|
nsICookieJarSettings** aCookieJarSettings) {
|
||||||
|
*aCookieJarSettings = mDocument->CookieJarSettings();
|
||||||
|
NS_ADDREF(*aCookieJarSettings);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebBrowserPersistLocalDocument::GetContentDisposition(nsAString& aCD) {
|
WebBrowserPersistLocalDocument::GetContentDisposition(nsAString& aCD) {
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> window = mDocument->GetWindow();
|
nsCOMPtr<nsPIDOMWindowOuter> window = mDocument->GetWindow();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "WebBrowserPersistSerializeParent.h"
|
#include "WebBrowserPersistSerializeParent.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/ipc/BackgroundUtils.h"
|
#include "mozilla/ipc/BackgroundUtils.h"
|
||||||
|
#include "mozilla/net/CookieJarSettings.h"
|
||||||
|
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
|
@ -29,6 +30,9 @@ WebBrowserPersistRemoteDocument ::WebBrowserPersistRemoteDocument(
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("Failed to obtain principal!");
|
NS_WARNING("Failed to obtain principal!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
net::CookieJarSettings::Deserialize(mAttrs.cookieJarSettings(),
|
||||||
|
getter_AddRefs(mCookieJarSettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
WebBrowserPersistRemoteDocument::~WebBrowserPersistRemoteDocument() {
|
WebBrowserPersistRemoteDocument::~WebBrowserPersistRemoteDocument() {
|
||||||
|
@ -92,6 +96,14 @@ WebBrowserPersistRemoteDocument::GetReferrerInfo(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebBrowserPersistRemoteDocument::GetCookieJarSettings(
|
||||||
|
nsICookieJarSettings** aCookieJarSettings) {
|
||||||
|
nsCOMPtr<nsICookieJarSettings> cookieJarSettings = mCookieJarSettings;
|
||||||
|
cookieJarSettings.forget(aCookieJarSettings);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebBrowserPersistRemoteDocument::GetContentDisposition(nsAString& aDisp) {
|
WebBrowserPersistRemoteDocument::GetContentDisposition(nsAString& aDisp) {
|
||||||
aDisp = mAttrs.contentDisposition();
|
aDisp = mAttrs.contentDisposition();
|
||||||
|
|
|
@ -41,6 +41,7 @@ class WebBrowserPersistRemoteDocument final
|
||||||
WebBrowserPersistDocumentParent* mActor;
|
WebBrowserPersistDocumentParent* mActor;
|
||||||
Attrs mAttrs;
|
Attrs mAttrs;
|
||||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||||
|
nsCOMPtr<nsICookieJarSettings> mCookieJarSettings;
|
||||||
nsCOMPtr<nsIInputStream> mPostData;
|
nsCOMPtr<nsIInputStream> mPostData;
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ interface nsIWebBrowserPersistResourceVisitor;
|
||||||
interface nsIWebBrowserPersistWriteCompletion;
|
interface nsIWebBrowserPersistWriteCompletion;
|
||||||
interface nsIReferrerInfo;
|
interface nsIReferrerInfo;
|
||||||
interface nsISHEntry;
|
interface nsISHEntry;
|
||||||
|
interface nsICookieJarSettings;
|
||||||
|
|
||||||
webidl BrowsingContext;
|
webidl BrowsingContext;
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ interface nsIWebBrowserPersistDocument : nsISupports
|
||||||
readonly attribute ACString characterSet;
|
readonly attribute ACString characterSet;
|
||||||
readonly attribute AString title;
|
readonly attribute AString title;
|
||||||
readonly attribute nsIReferrerInfo referrerInfo;
|
readonly attribute nsIReferrerInfo referrerInfo;
|
||||||
|
readonly attribute nsICookieJarSettings cookieJarSettings;
|
||||||
readonly attribute AString contentDisposition;
|
readonly attribute AString contentDisposition;
|
||||||
readonly attribute nsIInputStream postData;
|
readonly attribute nsIInputStream postData;
|
||||||
readonly attribute nsIPrincipal principal;
|
readonly attribute nsIPrincipal principal;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче