mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1591891 - Make the fix for bug 1536468 work with session history in the parent turned off. r=annyG
Differential Revision: https://phabricator.services.mozilla.com/D50786 --HG-- extra : rebase_source : 10199c278de3618e17497dc361d66262223c462d extra : source : cc77b3f6df12a3a2105941402bce9fedbacf255c extra : histedit_source : d4feddbc8a9dad5f9fab3860120d71b510e96ab6
This commit is contained in:
parent
20333f0715
commit
43968057e3
@ -18,6 +18,11 @@ using refcounted class nsIReferrerInfo from "mozilla/dom/ReferrerInfoUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
union SessionHistoryEntryOrCacheKey {
|
||||
nullable PSHEntry;
|
||||
uint32_t;
|
||||
};
|
||||
|
||||
// nsIWebBrowserPersistDocument has attributes which can be read
|
||||
// synchronously. To avoid using sync IPC for them, the actor sends
|
||||
// this structure from the child to the parent before the parent actor
|
||||
@ -31,7 +36,7 @@ struct WebBrowserPersistDocumentAttrs {
|
||||
nsString title;
|
||||
nsIReferrerInfo referrerInfo;
|
||||
nsString contentDisposition;
|
||||
nullable PSHEntry sessionHistoryEntry;
|
||||
SessionHistoryEntryOrCacheKey sessionHistoryEntryOrCacheKey;
|
||||
uint32_t persistFlags;
|
||||
PrincipalInfo principal;
|
||||
};
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "WebBrowserPersistResourcesChild.h"
|
||||
#include "WebBrowserPersistSerializeChild.h"
|
||||
#include "SHEntryChild.h"
|
||||
#include "mozilla/StaticPrefs_fission.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -57,10 +58,14 @@ void WebBrowserPersistDocumentChild::Start(
|
||||
ENSURE(aDocument->GetTitle(attrs.title()));
|
||||
ENSURE(aDocument->GetContentDisposition(attrs.contentDisposition()));
|
||||
|
||||
RefPtr<dom::SHEntryChild> shEntryChild =
|
||||
aDocument->GetHistory().downcast<dom::SHEntryChild>();
|
||||
if (shEntryChild) {
|
||||
attrs.sessionHistoryEntryChild() = shEntryChild.get();
|
||||
// shEntryChild needs to remain in scope until after the SendAttributes call,
|
||||
// to keep the actor alive.
|
||||
RefPtr<dom::SHEntryChild> shEntryChild;
|
||||
if (StaticPrefs::fission_sessionHistoryInParent()) {
|
||||
shEntryChild = aDocument->GetHistory().downcast<dom::SHEntryChild>();
|
||||
attrs.sessionHistoryEntryOrCacheKey() = shEntryChild;
|
||||
} else {
|
||||
attrs.sessionHistoryEntryOrCacheKey() = aDocument->GetCacheKey();
|
||||
}
|
||||
|
||||
ENSURE(aDocument->GetPersistFlags(&(attrs.persistFlags())));
|
||||
|
@ -24,9 +24,12 @@ WebBrowserPersistRemoteDocument ::WebBrowserPersistRemoteDocument(
|
||||
: mActor(aActor), mAttrs(aAttrs), mPostData(aPostData) {
|
||||
nsresult rv;
|
||||
mPrincipal = ipc::PrincipalInfoToPrincipal(mAttrs.principal(), &rv);
|
||||
mSHEntry =
|
||||
static_cast<dom::SHEntryParent*>(mAttrs.sessionHistoryEntryParent())
|
||||
->GetSHEntry();
|
||||
if (mAttrs.sessionHistoryEntryOrCacheKey().type() ==
|
||||
SessionHistoryEntryOrCacheKey::TPSHEntryParent) {
|
||||
mSHEntry = static_cast<dom::SHEntryParent*>(
|
||||
mAttrs.sessionHistoryEntryOrCacheKey().get_PSHEntryParent())
|
||||
->GetSHEntry();
|
||||
}
|
||||
}
|
||||
|
||||
WebBrowserPersistRemoteDocument::~WebBrowserPersistRemoteDocument() {
|
||||
@ -93,8 +96,13 @@ WebBrowserPersistRemoteDocument::GetContentDisposition(nsAString& aDisp) {
|
||||
NS_IMETHODIMP
|
||||
WebBrowserPersistRemoteDocument::GetCacheKey(uint32_t* aCacheKey) {
|
||||
*aCacheKey = 0;
|
||||
if (mSHEntry) {
|
||||
*aCacheKey = mSHEntry->GetCacheKey();
|
||||
if (mAttrs.sessionHistoryEntryOrCacheKey().type() ==
|
||||
SessionHistoryEntryOrCacheKey::TPSHEntryParent) {
|
||||
if (mSHEntry) {
|
||||
*aCacheKey = mSHEntry->GetCacheKey();
|
||||
}
|
||||
} else {
|
||||
*aCacheKey = mAttrs.sessionHistoryEntryOrCacheKey();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ interface nsIWebBrowserPersistDocument : nsISupports
|
||||
* The cache key. Unlike in nsISHEntry, where it's wrapped in an
|
||||
* nsISupportsPRUint32, this is just the integer.
|
||||
*/
|
||||
[infallible]
|
||||
readonly attribute unsigned long cacheKey;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user