Backed out 16 changesets (bug 1689601) for causing cpp bustages in nsFrameLoader.

CLOSED TREE

Backed out changeset 6e5523a7210d (bug 1689601)
Backed out changeset 745eaa468c74 (bug 1689601)
Backed out changeset a594bd02b8b6 (bug 1689601)
Backed out changeset 0c5fe977ced6 (bug 1689601)
Backed out changeset 2fca23521891 (bug 1689601)
Backed out changeset 334aeb627855 (bug 1689601)
Backed out changeset 2b2081a15d67 (bug 1689601)
Backed out changeset 307bde43cc96 (bug 1689601)
Backed out changeset 04aadec67ce2 (bug 1689601)
Backed out changeset 701eccb34772 (bug 1689601)
Backed out changeset 278db692aa8b (bug 1689601)
Backed out changeset c261c243a64d (bug 1689601)
Backed out changeset 7e8022e5696a (bug 1689601)
Backed out changeset 6138bfc6c08d (bug 1689601)
Backed out changeset 63295b3a62d0 (bug 1689601)
Backed out changeset 6d02e59ddc51 (bug 1689601)
This commit is contained in:
Mihai Alexandru Michis 2021-03-02 13:15:10 +02:00
Родитель 5b58a3f6a5
Коммит 87f481bf9a
40 изменённых файлов: 212 добавлений и 890 удалений

Просмотреть файл

@ -2621,25 +2621,6 @@ void BrowsingContext::DidSet(FieldIndex<IDX_UserAgentOverride>) {
});
}
bool BrowsingContext::CanSet(FieldIndex<IDX_IsInBFCache>, bool,
ContentParent* aSource) {
return IsTop() && !aSource && mozilla::BFCacheInParent();
}
void BrowsingContext::DidSet(FieldIndex<IDX_IsInBFCache>) {
MOZ_RELEASE_ASSERT(mozilla::BFCacheInParent());
MOZ_DIAGNOSTIC_ASSERT(IsTop());
const bool isInBFCache = GetIsInBFCache();
PreOrderWalk([&](BrowsingContext* aContext) {
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
if (shell) {
static_cast<nsDocShell*>(shell.get())
->FirePageHideShowNonRecursive(!isInBFCache);
}
});
}
void BrowsingContext::SetCustomPlatform(const nsAString& aPlatform,
ErrorResult& aRv) {
Top()->SetPlatformOverride(aPlatform, aRv);

Просмотреть файл

@ -197,8 +197,7 @@ enum class ExplicitActiveStatus : uint8_t {
FIELD(HasMainMediaController, bool) \
/* The number of entries added to the session history because of this \
* browsing context. */ \
FIELD(HistoryEntryCount, uint32_t) \
FIELD(IsInBFCache, bool)
FIELD(HistoryEntryCount, uint32_t)
// BrowsingContext, in this context, is the cross process replicated
// environment in which information about documents is stored. In
@ -1036,9 +1035,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void DidSet(FieldIndex<IDX_TextZoom>, float aOldValue);
void DidSet(FieldIndex<IDX_AuthorStyleDisabledDefault>);
bool CanSet(FieldIndex<IDX_IsInBFCache>, bool, ContentParent* aSource);
void DidSet(FieldIndex<IDX_IsInBFCache>);
// True if the process attemping to set field is the same as the owning
// process. Deprecated. New code that might use this should generally be moved
// to WindowContext or be settable only by the parent process.

Просмотреть файл

@ -24,7 +24,6 @@
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/net/DocumentLoadListener.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/StaticPrefs_fission.h"
#include "nsIWebNavigation.h"
#include "mozilla/MozPromiseInlines.h"
#include "nsDocShell.h"
@ -158,45 +157,21 @@ void CanonicalBrowsingContext::MaybeAddAsProgressListener(
}
void CanonicalBrowsingContext::ReplacedBy(
CanonicalBrowsingContext* aNewContext,
const RemotenessChangeOptions& aRemotenessOptions) {
MOZ_ASSERT(!aNewContext->mWebProgress);
MOZ_ASSERT(!aNewContext->mSessionHistory);
CanonicalBrowsingContext* aNewContext) {
MOZ_ASSERT(!aNewContext->EverAttached());
MOZ_ASSERT(IsTop() && aNewContext->IsTop());
if (mStatusFilter) {
mStatusFilter->RemoveProgressListener(mWebProgress);
mStatusFilter = nullptr;
}
aNewContext->mWebProgress = std::move(mWebProgress);
// Use the Transaction for the fields which need to be updated whether or not
// the new context has been attached before.
// SetWithoutSyncing can be used if context hasn't been attached.
Transaction txn;
txn.SetBrowserId(GetBrowserId());
txn.SetHistoryID(GetHistoryID());
txn.SetExplicitActive(GetExplicitActive());
if (aNewContext->EverAttached()) {
MOZ_ALWAYS_SUCCEEDS(txn.Commit(aNewContext));
} else {
txn.CommitWithoutSyncing(aNewContext);
}
// XXXBFCache name handling is still a bit broken in Fission in general,
// at least in case name should be cleared.
if (aRemotenessOptions.mTryUseBFCache) {
MOZ_ASSERT(!aNewContext->EverAttached());
aNewContext->mFields.SetWithoutSyncing<IDX_Name>(GetName());
aNewContext->mFields.SetWithoutSyncing<IDX_HasLoadedNonInitialDocument>(
GetHasLoadedNonInitialDocument());
}
aNewContext->mFields.SetWithoutSyncing<IDX_BrowserId>(GetBrowserId());
aNewContext->mFields.SetWithoutSyncing<IDX_HistoryID>(GetHistoryID());
aNewContext->mFields.SetWithoutSyncing<IDX_ExplicitActive>(
GetExplicitActive());
if (mSessionHistory) {
mSessionHistory->SetBrowsingContext(aNewContext);
if (mozilla::BFCacheInParent()) {
// XXXBFCache Should we clear the epoch always?
mSessionHistory->SetEpoch(0, Nothing());
}
mSessionHistory.swap(aNewContext->mSessionHistory);
RefPtr<ChildSHistory> childSHistory = ForgetChildSHistory();
aNewContext->SetChildSHistory(childSHistory);
@ -332,11 +307,6 @@ SessionHistoryEntry* CanonicalBrowsingContext::GetActiveSessionHistoryEntry() {
return mActiveEntry;
}
void CanonicalBrowsingContext::SetActiveSessionHistoryEntry(
SessionHistoryEntry* aEntry) {
mActiveEntry = aEntry;
}
bool CanonicalBrowsingContext::HasHistoryEntry(nsISHEntry* aEntry) {
// XXX Should we check also loading entries?
return aEntry && mActiveEntry == aEntry;
@ -1153,8 +1123,8 @@ void CanonicalBrowsingContext::PendingRemotenessChange::Finish() {
// The process has been created, hand off to nsFrameLoaderOwner to finish
// the process switch.
ErrorResult error;
frameLoaderOwner->ChangeRemotenessToProcess(mContentParent, mOptions,
mSpecificGroup, error);
frameLoaderOwner->ChangeRemotenessToProcess(
mContentParent, mReplaceBrowsingContext, mSpecificGroup, error);
if (error.Failed()) {
Cancel(error.StealNSResult());
return;
@ -1258,8 +1228,7 @@ void CanonicalBrowsingContext::PendingRemotenessChange::Finish() {
oldBrowser->Destroy();
}
MOZ_ASSERT(!mOptions.mReplaceBrowsingContext,
"Cannot replace BC for subframe");
MOZ_ASSERT(!mReplaceBrowsingContext, "Cannot replace BC for subframe");
nsCOMPtr<nsIPrincipal> initialPrincipal =
NullPrincipal::CreateWithInheritedAttributes(
target->OriginAttributesRef(),
@ -1345,11 +1314,11 @@ void CanonicalBrowsingContext::PendingRemotenessChange::Clear() {
CanonicalBrowsingContext::PendingRemotenessChange::PendingRemotenessChange(
CanonicalBrowsingContext* aTarget, RemotenessPromise::Private* aPromise,
uint64_t aPendingSwitchId, const RemotenessChangeOptions& aOptions)
uint64_t aPendingSwitchId, bool aReplaceBrowsingContext)
: mTarget(aTarget),
mPromise(aPromise),
mPendingSwitchId(aPendingSwitchId),
mOptions(aOptions) {}
mReplaceBrowsingContext(aReplaceBrowsingContext) {}
CanonicalBrowsingContext::PendingRemotenessChange::~PendingRemotenessChange() {
MOZ_ASSERT(!mPromise && !mTarget && !mContentParent && !mSpecificGroup &&
@ -1365,18 +1334,19 @@ BrowserParent* CanonicalBrowsingContext::GetBrowserParent() const {
}
RefPtr<CanonicalBrowsingContext::RemotenessPromise>
CanonicalBrowsingContext::ChangeRemoteness(
const RemotenessChangeOptions& aOptions, uint64_t aPendingSwitchId) {
CanonicalBrowsingContext::ChangeRemoteness(const nsACString& aRemoteType,
uint64_t aPendingSwitchId,
bool aReplaceBrowsingContext,
uint64_t aSpecificGroupId) {
MOZ_DIAGNOSTIC_ASSERT(IsContent(),
"cannot change the process of chrome contexts");
MOZ_DIAGNOSTIC_ASSERT(
IsTop() == IsEmbeddedInProcess(0),
"toplevel content must be embedded in the parent process");
MOZ_DIAGNOSTIC_ASSERT(!aOptions.mReplaceBrowsingContext || IsTop(),
MOZ_DIAGNOSTIC_ASSERT(!aReplaceBrowsingContext || IsTop(),
"Cannot replace BrowsingContext for subframes");
MOZ_DIAGNOSTIC_ASSERT(
aOptions.mSpecificGroupId == 0 || aOptions.mReplaceBrowsingContext,
"Cannot specify group ID unless replacing BC");
MOZ_DIAGNOSTIC_ASSERT(aSpecificGroupId == 0 || aReplaceBrowsingContext,
"Cannot specify group ID unless replacing BC");
MOZ_DIAGNOSTIC_ASSERT(aPendingSwitchId || !IsTop(),
"Should always have aPendingSwitchId for top-level "
"frames");
@ -1398,7 +1368,7 @@ CanonicalBrowsingContext::ChangeRemoteness(
return RemotenessPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, __func__);
}
if (aOptions.mRemoteType.IsEmpty() && (!IsTop() || !GetEmbedderElement())) {
if (aRemoteType.IsEmpty() && (!IsTop() || !GetEmbedderElement())) {
NS_WARNING("Cannot load non-remote subframes");
return RemotenessPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
@ -1413,7 +1383,7 @@ CanonicalBrowsingContext::ChangeRemoteness(
embedderWindowGlobal->GetBrowserParent();
// Switching to local. No new process, so perform switch sync.
if (embedderBrowser &&
aOptions.mRemoteType == embedderBrowser->Manager()->GetRemoteType()) {
aRemoteType == embedderBrowser->Manager()->GetRemoteType()) {
MOZ_DIAGNOSTIC_ASSERT(
aPendingSwitchId,
"We always have a PendingSwitchId, except for print-preview loads, "
@ -1435,8 +1405,8 @@ CanonicalBrowsingContext::ChangeRemoteness(
// If the embedder process is remote, tell that remote process to become
// the owner.
MOZ_DIAGNOSTIC_ASSERT(!aOptions.mReplaceBrowsingContext);
MOZ_DIAGNOSTIC_ASSERT(!aOptions.mRemoteType.IsEmpty());
MOZ_DIAGNOSTIC_ASSERT(!aReplaceBrowsingContext);
MOZ_DIAGNOSTIC_ASSERT(!aRemoteType.IsEmpty());
SetOwnerProcessId(embedderBrowser->Manager()->ChildID());
Unused << embedderWindowGlobal->SendMakeFrameLocal(this, aPendingSwitchId);
return RemotenessPromise::CreateAndResolve(embedderBrowser, __func__);
@ -1444,15 +1414,15 @@ CanonicalBrowsingContext::ChangeRemoteness(
// Switching to remote. Wait for new process to launch before switch.
auto promise = MakeRefPtr<RemotenessPromise::Private>(__func__);
RefPtr<PendingRemotenessChange> change =
new PendingRemotenessChange(this, promise, aPendingSwitchId, aOptions);
RefPtr<PendingRemotenessChange> change = new PendingRemotenessChange(
this, promise, aPendingSwitchId, aReplaceBrowsingContext);
mPendingRemotenessChange = change;
// If a specific BrowsingContextGroup ID was specified for this load, make
// sure to keep it alive until the process switch is completed.
if (aOptions.mSpecificGroupId) {
if (aSpecificGroupId) {
change->mSpecificGroup =
BrowsingContextGroup::GetOrCreate(aOptions.mSpecificGroupId);
BrowsingContextGroup::GetOrCreate(aSpecificGroupId);
change->mSpecificGroup->AddKeepAlive();
}
@ -1474,7 +1444,7 @@ CanonicalBrowsingContext::ChangeRemoteness(
change->mPrepareToChangePromise = GenericPromise::FromDomPromise(blocker);
}
if (aOptions.mRemoteType.IsEmpty()) {
if (aRemoteType.IsEmpty()) {
change->ProcessReady();
} else {
// Try to predict which BrowsingContextGroup will be used for the final load
@ -1485,12 +1455,11 @@ CanonicalBrowsingContext::ChangeRemoteness(
// It's _technically_ OK to provide a group here if we're actually going to
// switch into a brand new group, though it's sub-optimal, as it can
// restrict the set of processes we're using.
BrowsingContextGroup* finalGroup = aOptions.mReplaceBrowsingContext
? change->mSpecificGroup.get()
: Group();
BrowsingContextGroup* finalGroup =
aReplaceBrowsingContext ? change->mSpecificGroup.get() : Group();
change->mContentParent = ContentParent::GetNewOrUsedLaunchingBrowserProcess(
/* aRemoteType = */ aOptions.mRemoteType,
/* aRemoteType = */ aRemoteType,
/* aGroup = */ finalGroup,
/* aPriority = */ hal::PROCESS_PRIORITY_FOREGROUND,
/* aPreferUsed = */ false);
@ -1543,12 +1512,6 @@ bool CanonicalBrowsingContext::SupportsLoadingInParent(
return false;
}
// Session-history-in-parent implementation relies currently on getting a
// round trip through a child process.
if (aLoadState->LoadIsFromSessionHistory()) {
return false;
}
// DocumentChannel currently only supports connecting channels into the
// content process, so we can only support schemes that will always be loaded
// there for now. Restrict to just http(s) for simplicity.
@ -1622,6 +1585,12 @@ bool CanonicalBrowsingContext::AttemptSpeculativeLoadInParent(
return false;
}
// Session-history-in-parent implementation relies currently on getting a
// round trip through a child process.
if (aLoadState->LoadIsFromSessionHistory()) {
return false;
}
// If we successfully open the DocumentChannel, then it'll register
// itself using aLoadIdentifier and be kept alive until it completes
// loading.

Просмотреть файл

@ -44,15 +44,6 @@ struct LoadingSessionHistoryInfo;
class SessionHistoryEntry;
class WindowGlobalParent;
// RemotenessChangeOptions is passed through the methods to store the state
// of the possible remoteness change.
struct RemotenessChangeOptions {
nsCString mRemoteType;
bool mReplaceBrowsingContext = false;
uint64_t mSpecificGroupId = 0;
bool mTryUseBFCache = false;
};
// CanonicalBrowsingContext is a BrowsingContext living in the parent
// process, with whatever extra data that a BrowsingContext in the
// parent needs.
@ -120,7 +111,6 @@ class CanonicalBrowsingContext final : public BrowsingContext {
nsISHistory* GetSessionHistory();
SessionHistoryEntry* GetActiveSessionHistoryEntry();
void SetActiveSessionHistoryEntry(SessionHistoryEntry* aEntry);
UniquePtr<LoadingSessionHistoryInfo> CreateLoadingSessionHistoryEntryForLoad(
nsDocShellLoadState* aLoadState, nsIChannel* aChannel);
@ -216,8 +206,10 @@ class CanonicalBrowsingContext final : public BrowsingContext {
// A NOT_REMOTE_TYPE aRemoteType argument will perform a process switch into
// the parent process, and the method will resolve with a null BrowserParent.
using RemotenessPromise = MozPromise<RefPtr<BrowserParent>, nsresult, false>;
RefPtr<RemotenessPromise> ChangeRemoteness(
const RemotenessChangeOptions& aOptions, uint64_t aPendingSwitchId);
RefPtr<RemotenessPromise> ChangeRemoteness(const nsACString& aRemoteType,
uint64_t aPendingSwitchId,
bool aReplaceBrowsingContext,
uint64_t aSpecificGroupId);
// Return a media controller from the top-level browsing context that can
// control all media belonging to this browsing context tree. Return nullptr
@ -255,8 +247,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
// process).
// aNewContext is the newly created BrowsingContext that is replacing
// us.
void ReplacedBy(CanonicalBrowsingContext* aNewContext,
const RemotenessChangeOptions& aRemotenessOptions);
void ReplacedBy(CanonicalBrowsingContext* aNewContext);
bool HasHistoryEntry(nsISHEntry* aEntry);
@ -302,7 +293,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
PendingRemotenessChange(CanonicalBrowsingContext* aTarget,
RemotenessPromise::Private* aPromise,
uint64_t aPendingSwitchId,
const RemotenessChangeOptions& aOptions);
bool aReplaceBrowsingContext);
void Cancel(nsresult aRv);
@ -321,7 +312,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
RefPtr<BrowsingContextGroup> mSpecificGroup;
uint64_t mPendingSwitchId;
RemotenessChangeOptions mOptions;
bool mReplaceBrowsingContext;
};
friend class net::DocumentLoadListener;

Просмотреть файл

@ -74,16 +74,6 @@ class Transaction {
mozilla::ipc::IPCResult CommitFromIPC(const MaybeDiscarded<Context>& aOwner,
uint64_t aEpoch, ContentChild* aSource);
// Apply the changes from this transaction to the specified Context WITHOUT
// syncing the changes to other processes.
//
// Unlike `Commit`, this method will NOT call the corresponding `CanSet` or
// `DidSet` methods, and can be performed when the target context is
// unattached or discarded.
//
// NOTE: YOU PROBABLY DO NOT WANT TO USE THIS METHOD
void CommitWithoutSyncing(Context* aOwner);
private:
friend struct mozilla::ipc::IPDLParamTraits<Transaction<Context>>;

Просмотреть файл

@ -223,22 +223,6 @@ void Transaction<Context>::Apply(Context* aOwner, bool aFromIPC) {
mModified.clear();
}
template <typename Context>
void Transaction<Context>::CommitWithoutSyncing(Context* aOwner) {
MOZ_LOG(
Context::GetSyncLog(), LogLevel::Debug,
("Transaction::CommitWithoutSyncing(#%" PRIx64 "): %s", aOwner->Id(),
FormatTransaction<Context>(mModified, aOwner->mFields.mValues, mValues)
.get()));
EachIndex([&](auto idx) {
if (mModified.contains(idx)) {
aOwner->mFields.mValues.Get(idx) = std::move(mValues.Get(idx));
}
});
mModified.clear();
}
inline CanSetResult AsCanSetResult(CanSetResult aValue) { return aValue; }
inline CanSetResult AsCanSetResult(bool aValue) {
return aValue ? CanSetResult::Allow : CanSetResult::Deny;

Просмотреть файл

@ -1195,58 +1195,6 @@ void nsDocShell::FirePageHideNotificationInternal(
}
}
void nsDocShell::FirePageHideShowNonRecursive(bool aShow) {
MOZ_ASSERT(mozilla::BFCacheInParent());
if (!mContentViewer) {
return;
}
// Emulate what non-SHIP BFCache does too. In pageshow case
// add and remove a request and before that call SetCurrentURI to get
// the location change notification.
// For pagehide, set mFiredUnloadEvent to true, so that unload doesn't fire.
nsCOMPtr<nsIContentViewer> contentViewer(mContentViewer);
if (aShow) {
mFiredUnloadEvent = false;
RefPtr<Document> doc = contentViewer->GetDocument();
if (doc) {
if (mBrowsingContext->IsTop()) {
doc->NotifyPossibleTitleChange(false);
}
if (mScriptGlobal && mScriptGlobal->GetCurrentInnerWindowInternal()) {
mScriptGlobal->GetCurrentInnerWindowInternal()->Thaw(false);
}
nsCOMPtr<nsIChannel> channel = doc->GetChannel();
if (channel) {
SetCurrentURI(doc->GetDocumentURI(), channel, true, 0);
mEODForCurrentDocument = false;
mIsRestoringDocument = true;
mLoadGroup->AddRequest(channel, nullptr);
mLoadGroup->RemoveRequest(channel, nullptr, NS_OK);
mIsRestoringDocument = false;
}
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
presShell->Thaw(false);
}
}
} else if (!mFiredUnloadEvent) {
// XXXBFCache check again that the page can enter bfcache.
// XXXBFCache should mTiming->NotifyUnloadEventStart()/End() be called here?
mFiredUnloadEvent = true;
contentViewer->PageHide(false);
if (mScriptGlobal && mScriptGlobal->GetCurrentInnerWindowInternal()) {
mScriptGlobal->GetCurrentInnerWindowInternal()->Freeze(false);
}
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
presShell->Freeze(false);
}
}
}
nsresult nsDocShell::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) {
nsCOMPtr<nsIRunnable> runnable(aRunnable);
@ -3507,14 +3455,12 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
} else {
triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
}
if (mozilla::SessionHistoryInParent()) {
mActiveEntry = MakeUnique<SessionHistoryInfo>(
uri, triggeringPrincipal, nullptr, nullptr, nullptr,
nsLiteralCString("text/html"));
mBrowsingContext->SetActiveSessionHistoryEntry(
Nothing(), mActiveEntry.get(), MAKE_LOAD_TYPE(LOAD_NORMAL, loadFlags),
/* aUpdatedCacheKey = */ 0);
}
mActiveEntry = MakeUnique<SessionHistoryInfo>(
uri, triggeringPrincipal, nullptr, nullptr, nullptr,
nsLiteralCString("text/html"));
mBrowsingContext->SetActiveSessionHistoryEntry(
Nothing(), mActiveEntry.get(), MAKE_LOAD_TYPE(LOAD_NORMAL, loadFlags),
/* aUpdatedCacheKey = */ 0);
if (DisplayLoadError(rv, nullptr, PromiseFlatString(aURI).get(), nullptr) &&
(loadFlags & LOAD_FLAGS_ERROR_LOAD_CHANGES_RV) != 0) {
return NS_ERROR_LOAD_SHOWED_ERRORPAGE;
@ -6950,7 +6896,6 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
// Only save presentation for "normal" loads and link loads. Anything else
// probably wants to refetch the page, so caching the old presentation
// would be incorrect.
// XXXBFCache in parent needs something like this!
if (aLoadType != LOAD_NORMAL && aLoadType != LOAD_HISTORY &&
aLoadType != LOAD_LINK && aLoadType != LOAD_STOP_CONTENT &&
aLoadType != LOAD_STOP_CONTENT_AND_REPLACE &&
@ -6991,7 +6936,7 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
uint16_t bfCacheCombo = 0;
bool canSavePresentation =
doc->CanSavePresentation(aNewRequest, bfCacheCombo, true);
doc->CanSavePresentation(aNewRequest, bfCacheCombo);
MOZ_ASSERT_IF(canSavePresentation, bfCacheCombo == 0);
if (canSavePresentation && doc->IsTopLevelContentDocument()) {
auto* browsingContextGroup = mBrowsingContext->Group();

Просмотреть файл

@ -937,8 +937,6 @@ class nsDocShell final : public nsDocLoader,
void FirePageHideNotificationInternal(bool aIsUnload,
bool aSkipCheckingDynEntries);
void FirePageHideShowNonRecursive(bool aShow);
nsresult Dispatch(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable);

Просмотреть файл

@ -9,13 +9,11 @@
#include "nsDocShell.h"
#include "nsDocShellLoadState.h"
#include "nsIHttpChannel.h"
#include "nsIXULRuntime.h"
#include "nsSHEntryShared.h"
#include "nsSHistory.h"
#include "nsStructuredCloneContainer.h"
#include "nsXULAppAPI.h"
#include "mozilla/PresState.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/Tuple.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
@ -389,28 +387,20 @@ void SessionHistoryEntry::RemoveLoadId(uint64_t aLoadId) {
}
SessionHistoryEntry::SessionHistoryEntry()
: mInfo(new SessionHistoryInfo()), mID(++gEntryID) {
MOZ_ASSERT(mozilla::SessionHistoryInParent());
}
: mInfo(new SessionHistoryInfo()), mID(++gEntryID) {}
SessionHistoryEntry::SessionHistoryEntry(nsDocShellLoadState* aLoadState,
nsIChannel* aChannel)
: mInfo(new SessionHistoryInfo(aLoadState, aChannel)), mID(++gEntryID) {
MOZ_ASSERT(mozilla::SessionHistoryInParent());
}
: mInfo(new SessionHistoryInfo(aLoadState, aChannel)), mID(++gEntryID) {}
SessionHistoryEntry::SessionHistoryEntry(SessionHistoryInfo* aInfo)
: mInfo(MakeUnique<SessionHistoryInfo>(*aInfo)), mID(++gEntryID) {
MOZ_ASSERT(mozilla::SessionHistoryInParent());
}
: mInfo(MakeUnique<SessionHistoryInfo>(*aInfo)), mID(++gEntryID) {}
SessionHistoryEntry::SessionHistoryEntry(const SessionHistoryEntry& aEntry)
: mInfo(MakeUnique<SessionHistoryInfo>(*aEntry.mInfo)),
mParent(aEntry.mParent),
mID(aEntry.mID),
mBCHistoryLength(aEntry.mBCHistoryLength) {
MOZ_ASSERT(mozilla::SessionHistoryInParent());
}
mBCHistoryLength(aEntry.mBCHistoryLength) {}
SessionHistoryEntry::~SessionHistoryEntry() {
// Null out the mParent pointers on all our kids.
@ -1346,29 +1336,6 @@ SHEntrySharedParentState* SessionHistoryEntry::SharedInfo() const {
return static_cast<SHEntrySharedParentState*>(mInfo->mSharedState.Get());
}
void SessionHistoryEntry::SetFrameLoader(nsFrameLoader* aFrameLoader) {
MOZ_ASSERT_IF(aFrameLoader, !SharedInfo()->mFrameLoader);
// If the pref is disabled, we still allow evicting the existing entries.
MOZ_RELEASE_ASSERT(!aFrameLoader || mozilla::BFCacheInParent());
SharedInfo()->mFrameLoader = aFrameLoader;
if (aFrameLoader) {
// When a new frameloader is stored, try to evict some older
// frameloaders. Non-SHIP session history has a similar call in
// nsDocumentViewer::Show.
nsCOMPtr<nsISHistory> shistory;
GetShistory(getter_AddRefs(shistory));
if (shistory) {
int32_t index = 0;
shistory->GetIndex(&index);
shistory->EvictOutOfRangeContentViewers(index);
}
}
}
nsFrameLoader* SessionHistoryEntry::GetFrameLoader() {
return SharedInfo()->mFrameLoader;
}
void SessionHistoryEntry::SetInfo(SessionHistoryInfo* aInfo) {
// FIXME Assert that we're not changing shared state!
mInfo = MakeUnique<SessionHistoryInfo>(*aInfo);

Просмотреть файл

@ -340,9 +340,6 @@ class SessionHistoryEntry : public nsISHEntry {
SHEntrySharedParentState* SharedInfo() const;
void SetFrameLoader(nsFrameLoader* aFrameLoader);
nsFrameLoader* GetFrameLoader();
void AddChild(SessionHistoryEntry* aChild, int32_t aOffset,
bool aUseRemoteSubframes);
void RemoveChild(SessionHistoryEntry* aChild);

Просмотреть файл

@ -16,7 +16,7 @@
#include "nsIWebNavigation.h"
#include "nsSHistory.h"
#include "nsThreadUtils.h"
#include "nsFrameLoader.h"
#include "mozilla/Attributes.h"
#include "mozilla/Preferences.h"
@ -70,11 +70,6 @@ SHEntrySharedParentState::SHEntrySharedParentState(
SHEntrySharedParentState::~SHEntrySharedParentState() {
MOZ_ASSERT(mId != 0);
RefPtr<nsFrameLoader> loader = mFrameLoader.forget();
if (loader) {
loader->Destroy();
}
sIdToSharedState->Remove(mId);
if (sIdToSharedState->IsEmpty()) {
delete sIdToSharedState;
@ -116,14 +111,6 @@ void SHEntrySharedChildState::CopyFrom(SHEntrySharedChildState* aEntry) {
mChildShells.AppendObjects(aEntry->mChildShells);
}
void SHEntrySharedParentState::SetFrameLoader(nsFrameLoader* aFrameLoader) {
mFrameLoader = aFrameLoader;
}
nsFrameLoader* SHEntrySharedParentState::GetFrameLoader() {
return mFrameLoader;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -28,7 +28,6 @@ class nsIDocShellTreeItem;
class nsILayoutHistoryState;
class nsIPrincipal;
class nsDocShellEditorData;
class nsFrameLoader;
class nsIMutableArray;
class nsSHistory;
@ -97,10 +96,6 @@ class SHEntrySharedParentState : public SHEntrySharedState {
uint64_t GetId() const { return mId; }
void ChangeId(uint64_t aId);
void SetFrameLoader(nsFrameLoader* aFrameLoader);
nsFrameLoader* GetFrameLoader();
void NotifyListenersContentViewerEvicted();
SHEntrySharedParentState();
@ -135,8 +130,6 @@ class SHEntrySharedParentState : public SHEntrySharedState {
// they're specific to a particular content viewer.
nsWeakPtr mSHistory;
RefPtr<nsFrameLoader> mFrameLoader;
bool mSticky = true;
bool mDynamicallyCreated = false;

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsCOMArray.h"
#include "nsComponentManagerUtils.h"
#include "nsDocShell.h"
#include "nsFrameLoaderOwner.h"
#include "nsHashKeys.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
@ -32,15 +31,12 @@
#include "prsystem.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/BrowsingContextGroup.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/LinkedList.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "nsIWebNavigation.h"
@ -55,16 +51,12 @@ using namespace mozilla::dom;
"browser.sessionhistory.max_total_viewers"
#define CONTENT_VIEWER_TIMEOUT_SECONDS \
"browser.sessionhistory.contentViewerTimeout"
// Observe fission.bfcacheInParent so that BFCache can be enabled/disabled when
// the pref is changed.
#define PREF_FISSION_BFCACHEINPARENT "fission.bfcacheInParent"
// Default this to time out unused content viewers after 30 minutes
#define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30 * 60)
static const char* kObservedPrefs[] = {PREF_SHISTORY_SIZE,
PREF_SHISTORY_MAX_TOTAL_VIEWERS,
PREF_FISSION_BFCACHEINPARENT, nullptr};
static const char* kObservedPrefs[] = {
PREF_SHISTORY_SIZE, PREF_SHISTORY_MAX_TOTAL_VIEWERS, nullptr};
static int32_t gHistoryMaxSize = 50;
// List of all SHistory objects, used for content viewer cache eviction
@ -84,7 +76,6 @@ LazyLogModule gSHistoryLog("nsSHistory");
#define LOG(format) MOZ_LOG(gSHistoryLog, mozilla::LogLevel::Debug, format)
extern mozilla::LazyLogModule gPageCacheLog;
extern mozilla::LazyLogModule gSHIPBFCacheLog;
// This macro makes it easier to print a log message which includes a URI's
// spec. Example use:
@ -241,15 +232,6 @@ void nsSHistory::EvictContentViewerForEntry(nsISHEntry* aEntry) {
aEntry->SetContentViewer(nullptr);
aEntry->SyncPresentationState();
viewer->Destroy();
} else if (nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(aEntry)) {
if (RefPtr<nsFrameLoader> frameLoader = she->GetFrameLoader()) {
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("nsSHistory::EvictContentViewerForEntry "
"destroying an nsFrameLoader."));
NotifyListenersContentViewerEvicted(1);
she->SetFrameLoader(nullptr);
frameLoader->Destroy();
}
}
// When dropping bfcache, we have to remove associated dynamic entries as
@ -360,7 +342,7 @@ uint32_t nsSHistory::CalcMaxTotalViewers() {
// static
void nsSHistory::UpdatePrefs() {
Preferences::GetInt(PREF_SHISTORY_SIZE, &gHistoryMaxSize);
if (mozilla::SessionHistoryInParent() && !mozilla::BFCacheInParent()) {
if (mozilla::SessionHistoryInParent()) {
sHistoryMaxTotalViewers = 0;
return;
}
@ -1146,9 +1128,6 @@ nsSHistory::NotifyOnHistoryReload(bool* aCanReload) {
NS_IMETHODIMP
nsSHistory::EvictOutOfRangeContentViewers(int32_t aIndex) {
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("nsSHistory::EvictOutOfRangeContentViewers %i", aIndex));
// Check our per SHistory object limit in the currently navigated SHistory
EvictOutOfRangeWindowContentViewers(aIndex);
// Check our total limit across all SHistory objects
@ -1186,112 +1165,10 @@ nsSHistory::EvictAllContentViewers() {
return NS_OK;
}
/* static */
void nsSHistory::LoadURIOrBFCache(LoadEntryResult& aLoadEntry) {
if (mozilla::BFCacheInParent() && aLoadEntry.mBrowsingContext->IsTop()) {
MOZ_ASSERT(XRE_IsParentProcess());
RefPtr<nsDocShellLoadState> loadState = aLoadEntry.mLoadState;
RefPtr<CanonicalBrowsingContext> canonicalBC =
aLoadEntry.mBrowsingContext->Canonical();
nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(loadState->SHEntry());
nsCOMPtr<SessionHistoryEntry> currentShe =
canonicalBC->GetActiveSessionHistoryEntry();
MOZ_ASSERT(she);
RefPtr<nsFrameLoader> frameLoader = she->GetFrameLoader();
if (canonicalBC->Group()->Toplevels().Length() == 1 && frameLoader &&
(!currentShe || she->SharedInfo() != currentShe->SharedInfo())) {
nsTArray<RefPtr<PContentParent::CanSavePresentationPromise>>
canSavePromises;
canonicalBC->Group()->EachParent([&](ContentParent* aParent) {
RefPtr<PContentParent::CanSavePresentationPromise> canSave =
aParent->SendCanSavePresentation(canonicalBC, Nothing());
canSavePromises.AppendElement(canSave);
});
// Check if the current page can enter bfcache.
PContentParent::CanSavePresentationPromise::All(
GetCurrentSerialEventTarget(), canSavePromises)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[canonicalBC, loadState, she](const nsTArray<bool> aCanSaves) {
bool canSave = !aCanSaves.Contains(false);
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("nsSHistory::LoadURIOrBFCache "
"saving presentation=%i",
canSave));
nsCOMPtr<nsFrameLoaderOwner> frameLoaderOwner =
do_QueryInterface(canonicalBC->GetEmbedderElement());
if (frameLoaderOwner) {
RefPtr<nsFrameLoader> fl = she->GetFrameLoader();
if (fl) {
she->SetFrameLoader(nullptr);
RefPtr<BrowsingContext> loadingBC =
fl->GetMaybePendingBrowsingContext();
if (loadingBC) {
RefPtr<nsFrameLoader> currentFrameLoader =
frameLoaderOwner->GetFrameLoader();
// The current page can be bfcached, store the
// nsFrameLoader in the current SessionHistoryEntry.
if (canSave &&
canonicalBC->GetActiveSessionHistoryEntry()) {
canonicalBC->GetActiveSessionHistoryEntry()
->SetFrameLoader(currentFrameLoader);
Unused << canonicalBC->SetIsInBFCache(true);
}
// ReplacedBy will swap the entry back.
canonicalBC->SetActiveSessionHistoryEntry(she);
loadingBC->Canonical()->SetActiveSessionHistoryEntry(
nullptr);
RemotenessChangeOptions options;
canonicalBC->ReplacedBy(loadingBC->Canonical(), options);
frameLoaderOwner->ReplaceFrameLoader(fl);
// The old page can't be stored in the bfcache,
// destroy the nsFrameLoader.
if (!canSave && currentFrameLoader) {
currentFrameLoader->Destroy();
}
// The current active entry should not store
// nsFrameLoader.
loadingBC->Canonical()
->GetSessionHistory()
->UpdateIndex();
loadingBC->Canonical()->HistoryCommitIndexAndLength();
Unused << loadingBC->SetIsInBFCache(false);
// ResetSHEntryHasUserInteractionCache(); ?
// browser.navigation.requireUserInteraction is still
// disabled everywhere.
return;
}
}
}
// Fall back to do a normal load.
canonicalBC->LoadURI(loadState, false);
},
[canonicalBC, loadState](mozilla::ipc::ResponseRejectReason) {
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("nsSHistory::LoadURIOrBFCache "
"error in trying to save presentation"));
canonicalBC->LoadURI(loadState, false);
});
return;
}
if (frameLoader) {
she->SetFrameLoader(nullptr);
frameLoader->Destroy();
}
}
aLoadEntry.mBrowsingContext->LoadURI(aLoadEntry.mLoadState, false);
}
/* static */
void nsSHistory::LoadURIs(nsTArray<LoadEntryResult>& aLoadResults) {
for (LoadEntryResult& loadEntry : aLoadResults) {
LoadURIOrBFCache(loadEntry);
loadEntry.mBrowsingContext->LoadURI(loadEntry.mLoadState, false);
}
}
@ -1420,18 +1297,9 @@ void nsSHistory::EvictOutOfRangeWindowContentViewers(int32_t aIndex) {
// evicted. Collect a set of them so we don't accidentally evict one of them
// if it appears outside this range.
nsCOMArray<nsIContentViewer> safeViewers;
nsTArray<RefPtr<nsFrameLoader>> safeFrameLoaders;
for (int32_t i = startSafeIndex; i <= endSafeIndex; i++) {
nsCOMPtr<nsIContentViewer> viewer = mEntries[i]->GetContentViewer();
if (viewer) {
safeViewers.AppendObject(viewer);
} else if (nsCOMPtr<SessionHistoryEntry> she =
do_QueryInterface(mEntries[i])) {
nsFrameLoader* frameLoader = she->GetFrameLoader();
if (frameLoader) {
safeFrameLoaders.AppendElement(frameLoader);
}
}
safeViewers.AppendObject(viewer);
}
// Walk the SHistory list and evict any content viewers that aren't safe.
@ -1440,18 +1308,8 @@ void nsSHistory::EvictOutOfRangeWindowContentViewers(int32_t aIndex) {
for (int32_t i = 0; i < Length(); i++) {
nsCOMPtr<nsISHEntry> entry = mEntries[i];
nsCOMPtr<nsIContentViewer> viewer = entry->GetContentViewer();
if (viewer) {
if (safeViewers.IndexOf(viewer) == -1) {
EvictContentViewerForEntry(entry);
}
} else if (nsCOMPtr<SessionHistoryEntry> she =
do_QueryInterface(mEntries[i])) {
nsFrameLoader* frameLoader = she->GetFrameLoader();
if (frameLoader) {
if (!safeFrameLoaders.Contains(frameLoader)) {
EvictContentViewerForEntry(entry);
}
}
if (safeViewers.IndexOf(viewer) == -1) {
EvictContentViewerForEntry(entry);
}
}
}
@ -1466,12 +1324,7 @@ class EntryAndDistance {
mViewer(aEntry->GetContentViewer()),
mLastTouched(mEntry->GetLastTouched()),
mDistance(aDist) {
nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(aEntry);
if (she) {
mFrameLoader = she->GetFrameLoader();
}
NS_ASSERTION(mViewer || (mozilla::BFCacheInParent() && mFrameLoader),
"Entry should have a content viewer or frame loader.");
NS_ASSERTION(mViewer, "Entry should have a content viewer");
}
bool operator<(const EntryAndDistance& aOther) const {
@ -1494,7 +1347,6 @@ class EntryAndDistance {
RefPtr<nsSHistory> mSHistory;
nsCOMPtr<nsISHEntry> mEntry;
nsCOMPtr<nsIContentViewer> mViewer;
RefPtr<nsFrameLoader> mFrameLoader;
uint32_t mLastTouched;
int32_t mDistance;
};
@ -1540,14 +1392,12 @@ void nsSHistory::GloballyEvictContentViewers() {
nsCOMPtr<nsISHEntry> entry = shist->mEntries[i];
nsCOMPtr<nsIContentViewer> contentViewer = entry->GetContentViewer();
bool found = false;
bool hasContentViewerOrFrameLoader = false;
if (contentViewer) {
hasContentViewerOrFrameLoader = true;
// Because one content viewer might belong to multiple SHEntries, we
// have to search through shEntries to see if we already know
// about this content viewer. If we find the viewer, update its
// distance from the SHistory's index and continue.
bool found = false;
for (uint32_t j = 0; j < shEntries.Length(); j++) {
EntryAndDistance& container = shEntries[j];
if (container.mViewer == contentViewer) {
@ -1557,28 +1407,14 @@ void nsSHistory::GloballyEvictContentViewers() {
break;
}
}
} else if (nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(entry)) {
if (RefPtr<nsFrameLoader> frameLoader = she->GetFrameLoader()) {
hasContentViewerOrFrameLoader = true;
// Similar search as above but using frameloader.
for (uint32_t j = 0; j < shEntries.Length(); j++) {
EntryAndDistance& container = shEntries[j];
if (container.mFrameLoader == frameLoader) {
container.mDistance = std::min(container.mDistance,
DeprecatedAbs(i - shist->mIndex));
found = true;
break;
}
}
}
}
// If we didn't find a EntryAndDistance for this content viewer /
// frameloader, make a new one.
if (hasContentViewerOrFrameLoader && !found) {
EntryAndDistance container(shist, entry,
DeprecatedAbs(i - shist->mIndex));
shEntries.AppendElement(container);
// If we didn't find a EntryAndDistance for this content viewer, make a
// new one.
if (!found) {
EntryAndDistance container(shist, entry,
DeprecatedAbs(i - shist->mIndex));
shEntries.AppendElement(container);
}
}
}

Просмотреть файл

@ -154,7 +154,6 @@ class nsSHistory : public mozilla::LinkedListElement<nsSHistory>,
};
static void LoadURIs(nsTArray<LoadEntryResult>& aLoadResults);
static void LoadURIOrBFCache(LoadEntryResult& aLoadEntry);
// If this doesn't return an error then either aLoadResult is set to nothing,
// in which case the caller should ignore the load, or it returns a valid

Просмотреть файл

@ -113,7 +113,6 @@
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_docshell.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/StaticPrefs_full_screen_api.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_network.h"
@ -430,7 +429,6 @@
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
mozilla::LazyLogModule gPageCacheLog("PageCache");
mozilla::LazyLogModule gSHIPBFCacheLog("SHIPBFCache");
mozilla::LazyLogModule gTimeoutDeferralLog("TimeoutDefer");
mozilla::LazyLogModule gUseCountersLog("UseCounters");
@ -10636,8 +10634,7 @@ void Document::CollectDescendantDocuments(
}
bool Document::CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheCombo,
bool aIncludeSubdocuments) {
uint16_t& aBFCacheCombo) {
bool ret = true;
if (!IsBFCachingAllowed()) {
@ -10766,16 +10763,16 @@ bool Document::CanSavePresentation(nsIRequest* aNewRequest,
ret = false;
}
if (aIncludeSubdocuments && mSubDocuments) {
if (mSubDocuments) {
for (auto iter = mSubDocuments->Iter(); !iter.Done(); iter.Next()) {
auto entry = static_cast<SubDocMapEntry*>(iter.Get());
Document* subdoc = entry->mSubDocument;
uint16_t subDocBFCacheCombo = 0;
// The aIgnoreRequest we were passed is only for us, so don't pass it on.
bool canCache = subdoc ? subdoc->CanSavePresentation(
nullptr, subDocBFCacheCombo, true)
: false;
bool canCache =
subdoc ? subdoc->CanSavePresentation(nullptr, subDocBFCacheCombo)
: false;
if (!canCache) {
MOZ_LOG(gPageCacheLog, mozilla::LogLevel::Verbose,
("Save of %s blocked due to subdocument blocked", uri.get()));
@ -10785,15 +10782,13 @@ bool Document::CanSavePresentation(nsIRequest* aNewRequest,
}
}
if (!mozilla::BFCacheInParent()) {
// BFCache is currently not compatible with remote subframes (bug 1609324)
if (RefPtr<BrowsingContext> browsingContext = GetBrowsingContext()) {
for (auto& child : browsingContext->Children()) {
if (!child->IsInProcess()) {
aBFCacheCombo |= BFCacheStatus::CONTAINS_REMOTE_SUBFRAMES;
ret = false;
break;
}
// BFCache is currently not compatible with remote subframes (bug 1609324)
if (RefPtr<BrowsingContext> browsingContext = GetBrowsingContext()) {
for (auto& child : browsingContext->Children()) {
if (!child->IsInProcess()) {
aBFCacheCombo |= BFCacheStatus::CONTAINS_REMOTE_SUBFRAMES;
ret = false;
break;
}
}
}
@ -11112,15 +11107,6 @@ void Document::DispatchPageTransition(EventTarget* aDispatchTarget,
void Document::OnPageShow(bool aPersisted, EventTarget* aDispatchStartTarget,
bool aOnlySystemGroup) {
if (MOZ_LOG_TEST(gSHIPBFCacheLog, LogLevel::Debug)) {
nsCString uri;
if (GetDocumentURI()) {
uri = GetDocumentURI()->GetSpecOrDefault();
}
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("Document::OnPageShow [%s] persisted=%i", uri.get(), aPersisted));
}
const bool inFrameLoaderSwap = !!aDispatchStartTarget;
MOZ_DIAGNOSTIC_ASSERT(
inFrameLoaderSwap ==
@ -11197,15 +11183,6 @@ static void ClearPendingFullscreenRequests(Document* aDoc);
void Document::OnPageHide(bool aPersisted, EventTarget* aDispatchStartTarget,
bool aOnlySystemGroup) {
if (MOZ_LOG_TEST(gSHIPBFCacheLog, LogLevel::Debug)) {
nsCString uri;
if (GetDocumentURI()) {
uri = GetDocumentURI()->GetSpecOrDefault();
}
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("Document::OnPageHide %s persisted=%i", uri.get(), aPersisted));
}
const bool inFrameLoaderSwap = !!aDispatchStartTarget;
MOZ_DIAGNOSTIC_ASSERT(
inFrameLoaderSwap ==

Просмотреть файл

@ -2319,8 +2319,8 @@ class Document : public nsINode,
/**
* Check whether it is safe to cache the presentation of this document
* and all of its subdocuments (depending on the 3rd param). This method
* checks the following conditions recursively:
* and all of its subdocuments. This method checks the following conditions
* recursively:
* - Some document types, such as plugin documents, cannot be safely cached.
* - If there are any pending requests, we don't allow the presentation
* to be cached. Ideally these requests would be suspended and resumed,
@ -2338,8 +2338,7 @@ class Document : public nsINode,
* combination is when we try to BFCache aNewRequest
*/
virtual bool CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheCombo,
bool aIncludeSubdocuments);
uint16_t& aBFCacheCombo);
virtual nsresult Init();

Просмотреть файл

@ -193,17 +193,12 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
mWillChangeProcess(false),
mObservingOwnerContent(false),
mTabProcessCrashFired(false),
mNotifyingCrash(false) {
nsCOMPtr<nsFrameLoaderOwner> owner = do_QueryInterface(aOwner);
owner->AttachFrameLoader(this);
}
mNotifyingCrash(false) {}
nsFrameLoader::~nsFrameLoader() {
if (mMessageManager) {
mMessageManager->Disconnect();
}
MOZ_ASSERT(!mOwnerContent);
MOZ_RELEASE_ASSERT(mDestroyCalled);
}
@ -457,9 +452,8 @@ already_AddRefed<nsFrameLoader> nsFrameLoader::Create(
/* static */
already_AddRefed<nsFrameLoader> nsFrameLoader::Recreate(
mozilla::dom::Element* aOwner, BrowsingContext* aContext,
BrowsingContextGroup* aSpecificGroup,
const RemotenessChangeOptions& aRemotenessOptions, bool aIsRemote,
bool aNetworkCreated, bool aPreserveContext) {
BrowsingContextGroup* aSpecificGroup, bool aIsRemote, bool aNetworkCreated,
bool aPreserveContext) {
NS_ENSURE_TRUE(aOwner, nullptr);
#ifdef DEBUG
@ -479,8 +473,7 @@ already_AddRefed<nsFrameLoader> nsFrameLoader::Recreate(
MOZ_ASSERT(
XRE_IsParentProcess(),
"Recreating browing contexts only supported in the parent process");
aContext->Canonical()->ReplacedBy(context->Canonical(),
aRemotenessOptions);
aContext->Canonical()->ReplacedBy(context->Canonical());
}
}
NS_ENSURE_TRUE(context, nullptr);
@ -1877,9 +1870,6 @@ void nsFrameLoader::StartDestroy(bool aForProcessSwitch) {
!doc->InUnlinkOrDeletion();
doc->SetSubDocumentFor(mOwnerContent, nullptr);
MaybeUpdatePrimaryBrowserParent(eBrowserParentRemoved);
nsCOMPtr<nsFrameLoaderOwner> owner = do_QueryInterface(mOwnerContent);
owner->FrameLoaderDestroying(this);
SetOwnerContent(nullptr);
}
@ -2067,20 +2057,8 @@ void nsFrameLoader::SetOwnerContent(Element* aContent) {
mObservingOwnerContent = false;
mOwnerContent->RemoveMutationObserver(this);
}
// XXXBFCache Need to update also all the non-current FrameLoaders in the
// owner when moving a FrameLoader.
// This temporary setup doesn't crash, but behaves badly with bfcached docs.
if (RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(mOwnerContent)) {
owner->DetachFrameLoader(this);
}
mOwnerContent = aContent;
if (RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(mOwnerContent)) {
owner->AttachFrameLoader(this);
}
if (mSessionStoreListener && mOwnerContent) {
// mOwnerContent will only be null when the frame loader is being destroyed,
// so the session store listener will be destroyed along with it.

Просмотреть файл

@ -19,7 +19,6 @@
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/Nullable.h"
@ -72,7 +71,6 @@ class MutableTabContext;
class BrowserBridgeChild;
class RemoteBrowser;
struct RemotenessOptions;
struct RemotenessChangeOptions;
namespace ipc {
class StructuredCloneData;
@ -99,8 +97,7 @@ typedef struct _GtkWidget GtkWidget;
class nsFrameLoader final : public nsStubMutationObserver,
public mozilla::dom::ipc::MessageManagerCallback,
public nsWrapperCache,
public mozilla::LinkedListElement<nsFrameLoader> {
public nsWrapperCache {
friend class AutoResetInShow;
friend class AutoResetInFrameSwap;
friend class nsFrameLoaderOwner;
@ -122,7 +119,6 @@ class nsFrameLoader final : public nsStubMutationObserver,
// FrameLoaders.
static already_AddRefed<nsFrameLoader> Recreate(
Element* aOwner, BrowsingContext* aContext, BrowsingContextGroup* aGroup,
const mozilla::dom::RemotenessChangeOptions& aRemotenessOptions,
bool aIsRemote, bool aNetworkCreated, bool aPreserveContext);
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADER_IID)

Просмотреть файл

@ -11,8 +11,6 @@
#include "nsSubDocumentFrame.h"
#include "nsQueryObject.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/Logging.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/HTMLIFrameElement.h"
@ -25,8 +23,6 @@
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/EventStateManager.h"
extern mozilla::LazyLogModule gSHIPBFCacheLog;
using namespace mozilla;
using namespace mozilla::dom;
@ -91,8 +87,7 @@ nsFrameLoaderOwner::ShouldPreserveBrowsingContext(
void nsFrameLoaderOwner::ChangeRemotenessCommon(
const ChangeRemotenessContextType& aContextType,
const RemotenessChangeOptions& aOptions, bool aSwitchingInProgressLoad,
bool aIsRemote, BrowsingContextGroup* aGroup,
bool aSwitchingInProgressLoad, bool aIsRemote, BrowsingContextGroup* aGroup,
std::function<void()>& aFrameLoaderInit, mozilla::ErrorResult& aRv) {
MOZ_ASSERT_IF(aGroup, aContextType != ChangeRemotenessContextType::PRESERVE);
@ -129,40 +124,19 @@ void nsFrameLoaderOwner::ChangeRemotenessCommon(
// or want, so we use the initial (possibly pending) browsing context
// directly, instead.
bc = mFrameLoader->GetMaybePendingBrowsingContext();
if (aContextType == ChangeRemotenessContextType::PRESERVE) {
mFrameLoader->SetWillChangeProcess();
}
// Preserve the networkCreated status, as nsDocShells created after a
// process swap may shouldn't change their dynamically-created status.
networkCreated = mFrameLoader->IsNetworkCreated();
MOZ_ASSERT_IF(aOptions.mTryUseBFCache, aOptions.mReplaceBrowsingContext);
if (aOptions.mTryUseBFCache) {
if (bc) {
SessionHistoryEntry* she =
bc->Canonical()->GetActiveSessionHistoryEntry();
if (she) {
MOZ_LOG(
gSHIPBFCacheLog, LogLevel::Debug,
("nsFrameLoaderOwner::ChangeRemotenessCommon: store the old "
"page in bfcache"));
Unused << bc->SetIsInBFCache(true);
she->SetFrameLoader(mFrameLoader);
// Session history owns now the frameloader.
mFrameLoader = nullptr;
}
}
}
if (mFrameLoader) {
if (aContextType == ChangeRemotenessContextType::PRESERVE) {
mFrameLoader->SetWillChangeProcess();
}
// Preserve the networkCreated status, as nsDocShells created after a
// process swap may shouldn't change their dynamically-created status.
mFrameLoader->Destroy(aSwitchingInProgressLoad);
mFrameLoader = nullptr;
}
mFrameLoader->Destroy(aSwitchingInProgressLoad);
mFrameLoader = nullptr;
}
mFrameLoader = nsFrameLoader::Recreate(
owner, bc, aGroup, aOptions, aIsRemote, networkCreated,
owner, bc, aGroup, aIsRemote, networkCreated,
aContextType == ChangeRemotenessContextType::PRESERVE);
if (NS_WARN_IF(!mFrameLoader)) {
aRv.Throw(NS_ERROR_FAILURE);
@ -178,38 +152,34 @@ void nsFrameLoaderOwner::ChangeRemotenessCommon(
}
}
ChangeFrameLoaderCommon(owner);
}
void nsFrameLoaderOwner::ChangeFrameLoaderCommon(Element* aOwner) {
// Now that we've got a new FrameLoader, we need to reset our
// nsSubDocumentFrame to use the new FrameLoader.
if (nsSubDocumentFrame* ourFrame = do_QueryFrame(aOwner->GetPrimaryFrame())) {
if (nsSubDocumentFrame* ourFrame = do_QueryFrame(owner->GetPrimaryFrame())) {
ourFrame->ResetFrameLoader();
}
// If the element is focused, or the current mouse over target then
// we need to update that state for the new BrowserParent too.
if (nsFocusManager* fm = nsFocusManager::GetFocusManager()) {
if (fm->GetFocusedElement() == aOwner) {
fm->ActivateRemoteFrameIfNeeded(*aOwner,
if (fm->GetFocusedElement() == owner) {
fm->ActivateRemoteFrameIfNeeded(*owner,
nsFocusManager::GenerateFocusActionId());
}
}
if (aOwner->GetPrimaryFrame()) {
if (owner->GetPrimaryFrame()) {
EventStateManager* eventManager =
aOwner->GetPrimaryFrame()->PresContext()->EventStateManager();
eventManager->RecomputeMouseEnterStateForRemoteFrame(*aOwner);
owner->GetPrimaryFrame()->PresContext()->EventStateManager();
eventManager->RecomputeMouseEnterStateForRemoteFrame(*owner);
}
if (aOwner->IsXULElement()) {
if (owner->IsXULElement()) {
// Assuming this element is a XULFrameElement, once we've reset our
// FrameLoader, fire an event to act like we've recreated ourselves, similar
// to what XULFrameElement does after rebinding to the tree.
// ChromeOnlyDispatch is turns on to make sure this isn't fired into
// content.
(new mozilla::AsyncEventDispatcher(aOwner, u"XULFrameLoaderCreated"_ns,
(new mozilla::AsyncEventDispatcher(owner, u"XULFrameLoaderCreated"_ns,
mozilla::CanBubble::eYes,
mozilla::ChromeOnlyDispatch::eYes))
->RunDOMEventWhenSafe();
@ -234,10 +204,8 @@ void nsFrameLoaderOwner::ChangeRemoteness(
auto shouldPreserve = ShouldPreserveBrowsingContext(
isRemote, /* replaceBrowsingContext */ false);
RemotenessChangeOptions options;
ChangeRemotenessCommon(shouldPreserve, options,
aOptions.mSwitchingInProgressLoad, isRemote,
/* group */ nullptr, frameLoaderInit, rv);
ChangeRemotenessCommon(shouldPreserve, aOptions.mSwitchingInProgressLoad,
isRemote, /* group */ nullptr, frameLoaderInit, rv);
}
void nsFrameLoaderOwner::ChangeRemotenessWithBridge(BrowserBridgeChild* aBridge,
@ -255,18 +223,17 @@ void nsFrameLoaderOwner::ChangeRemotenessWithBridge(BrowserBridgeChild* aBridge,
mFrameLoader->mRemoteBrowser = host;
};
RemotenessChangeOptions options;
ChangeRemotenessCommon(ChangeRemotenessContextType::PRESERVE, options,
ChangeRemotenessCommon(ChangeRemotenessContextType::PRESERVE,
/* inProgress */ true,
/* isRemote */ true, /* group */ nullptr,
frameLoaderInit, rv);
}
void nsFrameLoaderOwner::ChangeRemotenessToProcess(
ContentParent* aContentParent, const RemotenessChangeOptions& aOptions,
ContentParent* aContentParent, bool aReplaceBrowsingContext,
BrowsingContextGroup* aGroup, mozilla::ErrorResult& rv) {
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT_IF(aGroup, aOptions.mReplaceBrowsingContext);
MOZ_ASSERT_IF(aGroup, aReplaceBrowsingContext);
bool isRemote = aContentParent != nullptr;
std::function<void()> frameLoaderInit = [&] {
@ -277,9 +244,9 @@ void nsFrameLoaderOwner::ChangeRemotenessToProcess(
};
auto shouldPreserve =
ShouldPreserveBrowsingContext(isRemote, aOptions.mReplaceBrowsingContext);
ChangeRemotenessCommon(shouldPreserve, aOptions, /* inProgress */ true,
isRemote, aGroup, frameLoaderInit, rv);
ShouldPreserveBrowsingContext(isRemote, aReplaceBrowsingContext);
ChangeRemotenessCommon(shouldPreserve, /* inProgress */ true, isRemote,
aGroup, frameLoaderInit, rv);
}
void nsFrameLoaderOwner::SubframeCrashed() {
@ -306,47 +273,7 @@ void nsFrameLoaderOwner::SubframeCrashed() {
}));
};
RemotenessChangeOptions options;
ChangeRemotenessCommon(ChangeRemotenessContextType::PRESERVE, options,
ChangeRemotenessCommon(ChangeRemotenessContextType::PRESERVE,
/* inProgress */ false, /* isRemote */ false,
/* group */ nullptr, frameLoaderInit, IgnoreErrors());
}
void nsFrameLoaderOwner::ReplaceFrameLoader(nsFrameLoader* aNewFrameLoader) {
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("nsFrameLoaderOwner::ReplaceFrameLoader: Replace frameloader"));
mFrameLoader = aNewFrameLoader;
if (auto* browserParent = mFrameLoader->GetBrowserParent()) {
browserParent->AddWindowListeners();
browserParent->ResumeProgressEvents();
}
RefPtr<Element> owner = do_QueryObject(this);
ChangeFrameLoaderCommon(owner);
}
void nsFrameLoaderOwner::AttachFrameLoader(nsFrameLoader* aFrameLoader) {
mFrameLoaderList.insertBack(aFrameLoader);
}
void nsFrameLoaderOwner::DetachFrameLoader(nsFrameLoader* aFrameLoader) {
if (aFrameLoader->isInList()) {
MOZ_ASSERT(mFrameLoaderList.contains(aFrameLoader));
aFrameLoader->remove();
}
}
void nsFrameLoaderOwner::FrameLoaderDestroying(nsFrameLoader* aFrameLoader) {
if (aFrameLoader == mFrameLoader) {
while (!mFrameLoaderList.isEmpty()) {
RefPtr<nsFrameLoader> loader = mFrameLoaderList.popFirst();
if (loader != mFrameLoader) {
loader->Destroy();
}
}
} else {
DetachFrameLoader(aFrameLoader);
}
}

Просмотреть файл

@ -18,9 +18,7 @@ class BrowsingContext;
class BrowsingContextGroup;
class BrowserBridgeChild;
class ContentParent;
class Element;
struct RemotenessOptions;
struct RemotenessChangeOptions;
} // namespace dom
} // namespace mozilla
@ -73,19 +71,13 @@ class nsFrameLoaderOwner : public nsISupports {
//
// If `aReplaceBrowsingContext` is set, BrowsingContext preservation will be
// disabled for this process switch.
void ChangeRemotenessToProcess(
mozilla::dom::ContentParent* aContentParent,
const mozilla::dom::RemotenessChangeOptions& aOptions,
mozilla::dom::BrowsingContextGroup* aGroup, mozilla::ErrorResult& rv);
void ChangeRemotenessToProcess(mozilla::dom::ContentParent* aContentParent,
bool aReplaceBrowsingContext,
mozilla::dom::BrowsingContextGroup* aGroup,
mozilla::ErrorResult& rv);
void SubframeCrashed();
void ReplaceFrameLoader(nsFrameLoader* aNewFrameLoader);
void AttachFrameLoader(nsFrameLoader* aFrameLoader);
void DetachFrameLoader(nsFrameLoader* aFrameLoader);
void FrameLoaderDestroying(nsFrameLoader* aFrameLoader);
private:
bool UseRemoteSubframes();
@ -102,23 +94,15 @@ class nsFrameLoaderOwner : public nsISupports {
ChangeRemotenessContextType ShouldPreserveBrowsingContext(
bool aIsRemote, bool aReplaceBrowsingContext);
void ChangeRemotenessCommon(
const ChangeRemotenessContextType& aContextType,
const mozilla::dom::RemotenessChangeOptions& aOptions,
bool aSwitchingInProgressLoad, bool aIsRemote,
mozilla::dom::BrowsingContextGroup* aGroup,
std::function<void()>& aFrameLoaderInit, mozilla::ErrorResult& aRv);
void ChangeFrameLoaderCommon(mozilla::dom::Element* aOwner);
void ChangeRemotenessCommon(const ChangeRemotenessContextType& aContextType,
bool aSwitchingInProgressLoad, bool aIsRemote,
mozilla::dom::BrowsingContextGroup* aGroup,
std::function<void()>& aFrameLoaderInit,
mozilla::ErrorResult& aRv);
protected:
virtual ~nsFrameLoaderOwner() = default;
RefPtr<nsFrameLoader> mFrameLoader;
// The list contains all the nsFrameLoaders created for this owner or moved
// from another nsFrameLoaderOwner which haven't been destroyed yet.
// In particular it contains all the nsFrameLoaders which are in bfcache.
mozilla::LinkedList<nsFrameLoader> mFrameLoaderList;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoaderOwner, NS_FRAMELOADEROWNER_IID)

Просмотреть файл

@ -2419,13 +2419,11 @@ bool nsPIDOMWindowInner::IsSecureContext() const {
return nsGlobalWindowInner::Cast(this)->IsSecureContext();
}
void nsPIDOMWindowInner::Suspend(bool aIncludeSubWindows) {
nsGlobalWindowInner::Cast(this)->Suspend(aIncludeSubWindows);
void nsPIDOMWindowInner::Suspend() {
nsGlobalWindowInner::Cast(this)->Suspend();
}
void nsPIDOMWindowInner::Resume(bool aIncludeSubWindows) {
nsGlobalWindowInner::Cast(this)->Resume(aIncludeSubWindows);
}
void nsPIDOMWindowInner::Resume() { nsGlobalWindowInner::Cast(this)->Resume(); }
void nsPIDOMWindowInner::SyncStateFromParentWindow() {
nsGlobalWindowInner::Cast(this)->SyncStateFromParentWindow();
@ -5443,7 +5441,7 @@ already_AddRefed<StorageEvent> nsGlobalWindowInner::CloneStorageEvent(
return event.forget();
}
void nsGlobalWindowInner::Suspend(bool aIncludeSubWindows) {
void nsGlobalWindowInner::Suspend() {
MOZ_ASSERT(NS_IsMainThread());
// We can only safely suspend windows that are the current inner window. If
@ -5461,9 +5459,7 @@ void nsGlobalWindowInner::Suspend(bool aIncludeSubWindows) {
// All children are also suspended. This ensure mSuspendDepth is
// set properly and the timers are properly canceled for each child.
if (aIncludeSubWindows) {
CallOnInProcessChildren(&nsGlobalWindowInner::Suspend, aIncludeSubWindows);
}
CallOnInProcessChildren(&nsGlobalWindowInner::Suspend);
mSuspendDepth += 1;
if (mSuspendDepth != 1) {
@ -5495,7 +5491,7 @@ void nsGlobalWindowInner::Suspend(bool aIncludeSubWindows) {
}
}
void nsGlobalWindowInner::Resume(bool aIncludeSubWindows) {
void nsGlobalWindowInner::Resume() {
MOZ_ASSERT(NS_IsMainThread());
// We can only safely resume a window if its the current inner window. If
@ -5510,9 +5506,7 @@ void nsGlobalWindowInner::Resume(bool aIncludeSubWindows) {
// Resume all children. This restores timers recursively canceled
// in Suspend() and ensures all children have the correct mSuspendDepth.
if (aIncludeSubWindows) {
CallOnInProcessChildren(&nsGlobalWindowInner::Resume, aIncludeSubWindows);
}
CallOnInProcessChildren(&nsGlobalWindowInner::Resume);
if (mSuspendDepth == 0) {
// Ignore if the window is not suspended.
@ -5562,23 +5556,20 @@ bool nsGlobalWindowInner::IsSuspended() const {
return mSuspendDepth != 0;
}
void nsGlobalWindowInner::Freeze(bool aIncludeSubWindows) {
void nsGlobalWindowInner::Freeze() {
MOZ_ASSERT(NS_IsMainThread());
Suspend(aIncludeSubWindows);
FreezeInternal(aIncludeSubWindows);
Suspend();
FreezeInternal();
}
void nsGlobalWindowInner::FreezeInternal(bool aIncludeSubWindows) {
void nsGlobalWindowInner::FreezeInternal() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(IsCurrentInnerWindow());
MOZ_DIAGNOSTIC_ASSERT(IsSuspended());
HintIsLoading(false);
if (aIncludeSubWindows) {
CallOnInProcessChildren(&nsGlobalWindowInner::FreezeInternal,
aIncludeSubWindows);
}
CallOnInProcessChildren(&nsGlobalWindowInner::FreezeInternal);
mFreezeDepth += 1;
MOZ_ASSERT(mSuspendDepth >= mFreezeDepth);
@ -5601,21 +5592,18 @@ void nsGlobalWindowInner::FreezeInternal(bool aIncludeSubWindows) {
NotifyDOMWindowFrozen(this);
}
void nsGlobalWindowInner::Thaw(bool aIncludeSubWindows) {
void nsGlobalWindowInner::Thaw() {
MOZ_ASSERT(NS_IsMainThread());
ThawInternal(aIncludeSubWindows);
Resume(aIncludeSubWindows);
ThawInternal();
Resume();
}
void nsGlobalWindowInner::ThawInternal(bool aIncludeSubWindows) {
void nsGlobalWindowInner::ThawInternal() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(IsCurrentInnerWindow());
MOZ_DIAGNOSTIC_ASSERT(IsSuspended());
if (aIncludeSubWindows) {
CallOnInProcessChildren(&nsGlobalWindowInner::ThawInternal,
aIncludeSubWindows);
}
CallOnInProcessChildren(&nsGlobalWindowInner::ThawInternal);
MOZ_ASSERT(mFreezeDepth != 0);
mFreezeDepth -= 1;

Просмотреть файл

@ -310,19 +310,19 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
void Suspend(bool aIncludeSubWindows = true);
void Resume(bool aIncludeSubWindows = true);
void Suspend();
void Resume();
virtual bool IsSuspended() const override;
// Calling Freeze() on a window will automatically Suspend() it. In
// addition, the window and its children (if aIncludeSubWindows is true) are
// further treated as no longer suitable for interaction with the user. For
// example, it may be marked non-visible, cannot be focused, etc. All worker
// threads are also frozen bringing them to a complete stop. A window can
// have Freeze() called multiple times and will only thaw after a matching
// number of Thaw() calls.
void Freeze(bool aIncludeSubWindows = true);
void Thaw(bool aIncludeSubWindows = true);
// addition, the window and its children are further treated as no longer
// suitable for interaction with the user. For example, it may be marked
// non-visible, cannot be focused, etc. All worker threads are also frozen
// bringing them to a complete stop. A window can have Freeze() called
// multiple times and will only thaw after a matching number of Thaw()
// calls.
void Freeze();
void Thaw();
virtual bool IsFrozen() const override;
void SyncStateFromParentWindow();
@ -1064,8 +1064,8 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
return (aWindow->*aMethod)(aArgs...);
}
void FreezeInternal(bool aIncludeSubWindows);
void ThawInternal(bool aIncludeSubWindows);
void FreezeInternal();
void ThawInternal();
mozilla::CallState ShouldReportForServiceWorkerScopeInternal(
const nsACString& aScope, bool* aResultOut);

Просмотреть файл

@ -297,12 +297,12 @@ class nsPIDOMWindowInner : public mozIDOMWindow {
// Calling suspend should prevent any asynchronous tasks from
// executing javascript for this window. This means setTimeout,
// requestAnimationFrame, and events should not be fired. Suspending
// a window maybe also suspends its children. Workers may
// a window also suspends its children and workers. Workers may
// continue to perform computations in the background. A window
// can have Suspend() called multiple times and will only resume after
// a matching number of Resume() calls.
void Suspend(bool aIncludeSubWindows = true);
void Resume(bool aIncludeSubWindows = true);
void Suspend();
void Resume();
// Whether or not this window was suspended by the BrowserContextGroup
bool GetWasSuspendedByGroup() const { return mWasSuspendedByGroup; }

Просмотреть файл

@ -39,8 +39,8 @@ class PluginDocument final : public MediaDocument, public nsIPluginDocument {
void SetScriptGlobalObject(
nsIScriptGlobalObject* aScriptGlobalObject) override;
bool CanSavePresentation(nsIRequest* aNewRequest, uint16_t& aBFCacheStatus,
bool aIncludeSubdocuments = true) override;
bool CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheStatus) override;
const nsCString& GetType() const { return mMimeType; }
Element* GetPluginContent() { return mPluginContent; }
@ -135,8 +135,7 @@ void PluginDocument::SetScriptGlobalObject(
}
bool PluginDocument::CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheStatus,
bool aIncludeSubdocuments) {
uint16_t& aBFCacheStatus) {
// Full-page plugins cannot be cached, currently, because we don't have
// the stream listener data to feed to the plugin instance.
return false;

Просмотреть файл

@ -710,7 +710,6 @@ class BrowserParent final : public PBrowserParent,
// Suspend nsIWebProgressListener events. This is used to block any further
// progress events from the old process when process switching away.
void SuspendProgressEvents() { mSuspendedProgressEvents = true; }
void ResumeProgressEvents() { mSuspendedProgressEvents = false; }
bool CanCancelContentJS(nsIRemoteTab::NavigationType aNavigationType,
int32_t aNavigationIndex,

Просмотреть файл

@ -28,7 +28,6 @@
#include "mozilla/Components.h"
#include "mozilla/HangDetails.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/Logging.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/MemoryTelemetry.h"
#include "mozilla/NullPrincipal.h"
@ -42,7 +41,6 @@
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/SharedStyleSheetCache.h"
#include "mozilla/SimpleEnumerator.h"
#include "mozilla/SpinEventLoopUntil.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_fission.h"
@ -110,7 +108,6 @@
#include "mozilla/media/MediaChild.h"
#include "mozilla/net/CaptivePortalService.h"
#include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/DocumentChannelChild.h"
#include "mozilla/net/HttpChannelChild.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/plugins/PluginInstanceParent.h"
@ -123,9 +120,7 @@
#include "nsFocusManager.h"
#include "nsIConsoleService.h"
#include "nsIInputStreamChannel.h"
#include "nsILoadGroup.h"
#include "nsIOpenWindowInfo.h"
#include "nsISimpleEnumerator.h"
#include "nsIStringBundle.h"
#include "nsIURIMutator.h"
#include "nsQueryObject.h"
@ -295,8 +290,6 @@
# include "mozilla/CodeCoverageHandler.h"
#endif
extern mozilla::LazyLogModule gSHIPBFCacheLog;
using namespace mozilla;
using namespace mozilla::docshell;
using namespace mozilla::dom::ipc;
@ -4250,65 +4243,6 @@ mozilla::ipc::IPCResult ContentChild::RecvDispatchBeforeUnloadToSubtree(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentChild::RecvCanSavePresentation(
const MaybeDiscarded<BrowsingContext>& aTopLevelContext,
Maybe<uint64_t> aDocumentChannelId,
CanSavePresentationResolver&& aResolver) {
if (aTopLevelContext.IsNullOrDiscarded()) {
aResolver(false);
return IPC_OK();
}
bool canSave = true;
// XXXBFCache pass the flags to telemetry.
uint16_t flags = 0;
BrowsingContext* browsingContext = aTopLevelContext.get();
browsingContext->PreOrderWalk([&](BrowsingContext* aContext) {
Document* doc = aContext->GetDocument();
if (doc) {
nsIRequest* request = nullptr;
if (aDocumentChannelId.isSome() && aContext->IsTop()) {
nsCOMPtr<nsILoadGroup> loadGroup = doc->GetDocumentLoadGroup();
if (loadGroup) {
nsCOMPtr<nsISimpleEnumerator> requests;
loadGroup->GetRequests(getter_AddRefs(requests));
bool hasMore = false;
if (NS_SUCCEEDED(requests->HasMoreElements(&hasMore)) && hasMore) {
// If there are any requests, the only one we allow with bfcache
// is the DocumentChannel request.
nsCOMPtr<nsISupports> elem;
requests->GetNext(getter_AddRefs(elem));
nsCOMPtr<nsIIdentChannel> identChannel = do_QueryInterface(elem);
if (identChannel &&
identChannel->ChannelId() == aDocumentChannelId.value()) {
request = identChannel;
}
}
}
}
// Go through also the subdocuments so that flags are collected.
bool canSaveDoc = doc->CanSavePresentation(request, flags, false);
canSave = canSaveDoc && canSave;
if (MOZ_LOG_TEST(gSHIPBFCacheLog, LogLevel::Debug)) {
nsAutoCString uri;
if (doc->GetDocumentURI()) {
uri = doc->GetDocumentURI()->GetSpecOrDefault();
}
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("ContentChild::RecvCanSavePresentation can save presentation "
"[%i] for [%s]",
canSaveDoc, uri.get()));
}
}
});
aResolver(canSave);
return IPC_OK();
}
/* static */ void ContentChild::DispatchBeforeUnloadToSubtree(
BrowsingContext* aStartingAt,
const DispatchBeforeUnloadToSubtreeResolver& aResolver) {

Просмотреть файл

@ -824,11 +824,6 @@ class ContentChild final : public PContentChild,
const MaybeDiscarded<BrowsingContext>& aStartingAt,
DispatchBeforeUnloadToSubtreeResolver&& aResolver);
mozilla::ipc::IPCResult RecvCanSavePresentation(
const MaybeDiscarded<BrowsingContext>& aTopLevelContext,
Maybe<uint64_t> aDocumentChannelId,
CanSavePresentationResolver&& aResolve);
public:
static void DispatchBeforeUnloadToSubtree(
BrowsingContext* aStartingAt,

Просмотреть файл

@ -3880,9 +3880,9 @@ mozilla::ipc::IPCResult ContentParent::RecvCloneDocumentTreeInto(
return IPC_OK();
}
RemotenessChangeOptions options;
options.mRemoteType = cp->GetRemoteType();
target->ChangeRemoteness(options, /* aPendingSwitchId = */ 0)
target
->ChangeRemoteness(cp->GetRemoteType(), /* aLoadID = */ 0,
/* aReplaceBC = */ false, /* aSpecificGroupId = */ 0)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[source = RefPtr{source}](BrowserParent* aBp) {

Просмотреть файл

@ -9,7 +9,6 @@ include protocol PBrowser;
include protocol PCompositorManager;
include protocol PContentPermissionRequest;
include protocol PCycleCollectWithLogs;
include protocol PDocumentChannel;
include protocol PExternalHelperApp;
include protocol PHandlerService;
include protocol PFileDescriptorSet;
@ -946,9 +945,6 @@ child:
async DispatchBeforeUnloadToSubtree(MaybeDiscardedBrowsingContext aStartingAt)
returns (PermitUnloadResult result);
async CanSavePresentation(MaybeDiscardedBrowsingContext aTopLevelContext,
uint64_t? aDocumentChannelId) returns (bool success);
// Update the cached list of codec supported in the given process.
async UpdateMediaCodecsSupported(RemoteDecodeIn aLocation, MediaCodecsSupported aSupported);

Просмотреть файл

@ -48,10 +48,9 @@ void RecvPropagateBackgroundSessionStorageManager(
if (sManagers) {
if (RefPtr<BackgroundSessionStorageManager> mgr =
sManagers->Get(aCurrentTopContextId)) {
// Because of bfcache, we may re-register aTargetTopContextId in
// CanonicalBrowsingContext::ReplacedBy.
// XXXBFCache do we want to tweak this behavior and ensure this is
// called only once?
// Assuming the target top browsing context should haven't been
// registered yet.
MOZ_DIAGNOSTIC_ASSERT(!sManagers->Contains(aTargetTopContextId));
sManagers->InsertOrUpdate(aTargetTopContextId, std::move(mgr));
}
}

Просмотреть файл

@ -9316,7 +9316,7 @@ static CallState FreezeSubDocument(Document& aDocument) {
return CallState::Continue;
}
void PresShell::Freeze(bool aIncludeSubDocuments) {
void PresShell::Freeze() {
mUpdateApproximateFrameVisibilityEvent.Revoke();
MaybeReleaseCapturingContent();
@ -9327,7 +9327,7 @@ void PresShell::Freeze(bool aIncludeSubDocuments) {
mPaintingSuppressed = true;
if (aIncludeSubDocuments && mDocument) {
if (mDocument) {
mDocument->EnumerateSubDocuments(FreezeSubDocument);
}
@ -9370,14 +9370,14 @@ void PresShell::FireOrClearDelayedEvents(bool aFireEvents) {
}
}
void PresShell::Thaw(bool aIncludeSubDocuments) {
void PresShell::Thaw() {
nsPresContext* presContext = GetPresContext();
if (presContext &&
presContext->RefreshDriver()->GetPresContext() == presContext) {
presContext->RefreshDriver()->Thaw();
}
if (aIncludeSubDocuments && mDocument) {
if (mDocument) {
mDocument->EnumerateSubDocuments([](Document& aSubDoc) {
if (PresShell* presShell = aSubDoc.GetPresShell()) {
presShell->Thaw();

Просмотреть файл

@ -743,7 +743,7 @@ class PresShell final : public nsStubDocumentObserver,
* state.
* XXX this should include image animations
*/
void Freeze(bool aIncludeSubDocuments = true);
void Freeze();
bool IsFrozen() { return mFrozen; }
/**
@ -751,7 +751,7 @@ class PresShell final : public nsStubDocumentObserver,
* presentations of subdocuments, then do a full invalidate of the content
* area.
*/
void Thaw(bool aIncludeSubDocuments = true);
void Thaw();
void FireOrClearDelayedEvents(bool aFireEvents);

Просмотреть файл

@ -3749,13 +3749,6 @@
mirror: once
do_not_use_directly: true
# If session history is stored in the parent process, enable bfcache for it.
- name: fission.bfcacheInParent
type: bool
value: false
mirror: always
do_not_use_directly: true
# Allow renaming of process names to the origin on nightly
# Setting this pref creates a privacy leak, but helps greatly with
# debugging

Просмотреть файл

@ -11,11 +11,9 @@
#include "mozilla/net/HttpBaseChannel.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs_fission.h"
#include "nsHashPropertyBag.h"
#include "nsIHttpChannelInternal.h"
#include "nsIObjectLoadingContent.h"
#include "nsIXULRuntime.h"
#include "nsIWritablePropertyBag.h"
using namespace mozilla::dom;
@ -176,14 +174,7 @@ IPCResult DocumentChannelChild::RecvDisconnectChildListeners(
// notify them of the failure. If this is a process switch, then we can just
// ignore it silently, and trust that the switch will shut down our docshell
// and cancel us when it's ready.
// XXXBFCache This should be fixed in some better way.
bool disconnectChildListeners = !aSwitchedProcess;
if (!disconnectChildListeners && mozilla::BFCacheInParent()) {
nsDocShell* shell = GetDocShell();
disconnectChildListeners = shell && shell->GetBrowsingContext() &&
shell->GetBrowsingContext()->IsTop();
}
if (disconnectChildListeners) {
if (!aSwitchedProcess) {
DisconnectChildListeners(aStatus, aLoadGroupStatus);
}
return IPC_OK();

Просмотреть файл

@ -39,8 +39,7 @@ bool DocumentChannelParent::Init(dom::CanonicalBrowsingContext* aContext,
RefPtr<DocumentLoadListener::OpenPromise> promise;
if (loadState->GetChannelInitialized()) {
promise = DocumentLoadListener::ClaimParentLoad(
getter_AddRefs(mDocumentLoadListener), loadState->GetLoadIdentifier(),
Some(aArgs.channelId()));
getter_AddRefs(mDocumentLoadListener), loadState->GetLoadIdentifier());
}
if (!promise) {
bool isDocumentLoad =

Просмотреть файл

@ -46,7 +46,6 @@
#include "nsQueryObject.h"
#include "nsRedirectHistoryEntry.h"
#include "nsSandboxFlags.h"
#include "nsSHistory.h"
#include "nsStringStream.h"
#include "nsURILoader.h"
#include "nsWebNavigationInfo.h"
@ -65,8 +64,6 @@
mozilla::LazyLogModule gDocumentChannelLog("DocumentChannel");
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
extern mozilla::LazyLogModule gSHIPBFCacheLog;
using namespace mozilla::dom;
namespace mozilla {
@ -523,7 +520,6 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
if (identChannel && aChannelId) {
Unused << identChannel->SetChannelId(*aChannelId);
}
mDocumentChannelId = aChannelId;
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
if (httpChannelImpl) {
@ -908,8 +904,7 @@ void DocumentLoadListener::CleanupParentLoadAttempt(uint64_t aLoadIdent) {
}
auto DocumentLoadListener::ClaimParentLoad(DocumentLoadListener** aListener,
uint64_t aLoadIdent,
Maybe<uint64_t> aChannelId)
uint64_t aLoadIdent)
-> RefPtr<OpenPromise> {
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
RedirectChannelRegistrar::GetOrCreate();
@ -925,8 +920,6 @@ auto DocumentLoadListener::ClaimParentLoad(DocumentLoadListener** aListener,
return nullptr;
}
loadListener->mDocumentChannelId = aChannelId;
MOZ_DIAGNOSTIC_ASSERT(loadListener->mOpenPromise);
loadListener.forget(aListener);
@ -1497,7 +1490,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// Determine what type of content process this load should finish in.
nsAutoCString preferredRemoteType(currentRemoteType);
RemotenessChangeOptions options;
bool replaceBrowsingContext = false;
uint64_t specificGroupId = 0;
// If we're in a preloaded browser, force browsing context replacement to
// ensure the current process is re-selected.
@ -1512,7 +1506,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
if (NS_SUCCEEDED(mChannel->GetOriginalURI(getter_AddRefs(originalURI))) &&
!originalURI->GetSpecOrDefault().EqualsLiteral("about:newtab")) {
LOG(("Process Switch: leaving preloaded browser"));
options.mReplaceBrowsingContext = true;
replaceBrowsingContext = true;
browserElement->UnsetAttr(kNameSpaceID_None, nsGkAtoms::preloadedState,
true);
}
@ -1523,7 +1517,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers.
{
bool isCOOPSwitch = HasCrossOriginOpenerPolicyMismatch();
options.mReplaceBrowsingContext |= isCOOPSwitch;
replaceBrowsingContext |= isCOOPSwitch;
// Determine our COOP status, which will be used to determine our preferred
// remote type.
@ -1559,10 +1553,10 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
if (!parentWindow && browsingContext->Group()->Toplevels().Length() == 1) {
if (IsLargeAllocationLoad(browsingContext, mChannel)) {
preferredRemoteType = LARGE_ALLOCATION_REMOTE_TYPE;
options.mReplaceBrowsingContext = true;
replaceBrowsingContext = true;
} else if (preferredRemoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
preferredRemoteType = DEFAULT_REMOTE_TYPE;
options.mReplaceBrowsingContext = true;
replaceBrowsingContext = true;
}
}
@ -1580,8 +1574,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
if (browsingContext->Group()->Id() !=
addonPolicy->GetBrowsingContextGroupId()) {
options.mReplaceBrowsingContext = true;
options.mSpecificGroupId = addonPolicy->GetBrowsingContextGroupId();
replaceBrowsingContext = true;
specificGroupId = addonPolicy->GetBrowsingContextGroupId();
}
} else {
// As a temporary measure, extension iframes must be loaded within the
@ -1609,10 +1603,11 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
currentPrincipal = wgp->DocumentPrincipal();
}
nsAutoCString remoteType;
rv = e10sUtils->GetRemoteTypeForPrincipal(
resultPrincipal, mChannelCreationURI, browsingContext->UseRemoteTabs(),
browsingContext->UseRemoteSubframes(), preferredRemoteType,
currentPrincipal, parentWindow, options.mRemoteType);
currentPrincipal, parentWindow, remoteType);
if (NS_WARN_IF(NS_FAILED(rv))) {
LOG(("Process Switch Abort: getRemoteTypeForPrincipal threw an exception"));
return false;
@ -1621,81 +1616,32 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
// If the final decision is to switch from an 'extension' remote type to any
// other remote type, ensure the browsing context is replaced so that we leave
// the extension-specific BrowsingContextGroup.
if (!parentWindow && currentRemoteType != options.mRemoteType &&
if (!parentWindow && currentRemoteType != remoteType &&
currentRemoteType == EXTENSION_REMOTE_TYPE) {
options.mReplaceBrowsingContext = true;
}
if (mozilla::BFCacheInParent() && nsSHistory::GetMaxTotalViewers() > 0 &&
!parentWindow && !browsingContext->HadOriginalOpener() &&
browsingContext->Group()->Toplevels().Length() == 1 &&
!options.mRemoteType.IsEmpty() &&
browsingContext->GetHasLoadedNonInitialDocument() &&
mLoadStateLoadType != LOAD_ERROR_PAGE) {
options.mReplaceBrowsingContext = true;
options.mTryUseBFCache = true;
replaceBrowsingContext = true;
}
LOG(("GetRemoteTypeForPrincipal -> current:%s remoteType:%s",
currentRemoteType.get(), options.mRemoteType.get()));
currentRemoteType.get(), remoteType.get()));
// Check if a process switch is needed.
if (currentRemoteType == options.mRemoteType &&
!options.mReplaceBrowsingContext) {
LOG(("Process Switch Abort: type (%s) is compatible",
options.mRemoteType.get()));
if (currentRemoteType == remoteType && !replaceBrowsingContext) {
LOG(("Process Switch Abort: type (%s) is compatible", remoteType.get()));
return false;
}
if (NS_WARN_IF(parentWindow && options.mRemoteType.IsEmpty())) {
if (NS_WARN_IF(parentWindow && remoteType.IsEmpty())) {
LOG(("Process Switch Abort: non-remote target process for subframe"));
return false;
}
*aWillSwitchToRemote = !options.mRemoteType.IsEmpty();
*aWillSwitchToRemote = !remoteType.IsEmpty();
// If we're doing a document load, we can immediately perform a process
// switch.
if (mIsDocumentLoad) {
if (options.mTryUseBFCache && wgp) {
if (RefPtr<BrowserParent> browserParent = wgp->GetBrowserParent()) {
nsTArray<RefPtr<PContentParent::CanSavePresentationPromise>>
canSavePromises;
browsingContext->Group()->EachParent([&](ContentParent* aParent) {
RefPtr<PContentParent::CanSavePresentationPromise> canSave =
aParent->SendCanSavePresentation(browsingContext,
mDocumentChannelId);
canSavePromises.AppendElement(canSave);
});
PContentParent::CanSavePresentationPromise::All(
GetCurrentSerialEventTarget(), canSavePromises)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[self = RefPtr{this}, browsingContext,
options](const nsTArray<bool> aCanSaves) mutable {
bool canSave = !aCanSaves.Contains(false);
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("DocumentLoadListener::MaybeTriggerProcessSwitch "
"saving presentation=%i",
canSave));
options.mTryUseBFCache = canSave;
self->TriggerProcessSwitch(browsingContext, options);
},
[self = RefPtr{this}, browsingContext,
options](ipc::ResponseRejectReason) mutable {
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug,
("DocumentLoadListener::MaybeTriggerProcessSwitch "
"error in trying to save presentation"));
options.mTryUseBFCache = false;
self->TriggerProcessSwitch(browsingContext, options);
});
return true;
}
}
options.mTryUseBFCache = false;
TriggerProcessSwitch(browsingContext, options);
TriggerProcessSwitch(browsingContext, remoteType, replaceBrowsingContext,
specificGroupId);
return true;
}
@ -1714,8 +1660,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
mObjectUpgradeHandler->UpgradeObjectLoad()->Then(
GetMainThreadSerialEventTarget(), __func__,
[self = RefPtr{this}, options,
wgp](const RefPtr<CanonicalBrowsingContext>& aBrowsingContext) mutable {
[self = RefPtr{this}, remoteType, replaceBrowsingContext, specificGroupId,
wgp](const RefPtr<CanonicalBrowsingContext>& aBrowsingContext) {
if (aBrowsingContext->IsDiscarded() ||
wgp != aBrowsingContext->GetParentWindowContext()) {
LOG(
@ -1726,7 +1672,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
}
LOG(("Process Switch: Upgraded Object to Document Load"));
self->TriggerProcessSwitch(aBrowsingContext, options);
self->TriggerProcessSwitch(aBrowsingContext, remoteType,
replaceBrowsingContext, specificGroupId);
},
[self = RefPtr{this}](nsresult aStatusCode) {
MOZ_ASSERT(NS_FAILED(aStatusCode), "Status should be error");
@ -1736,8 +1683,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
}
void DocumentLoadListener::TriggerProcessSwitch(
CanonicalBrowsingContext* aContext,
const RemotenessChangeOptions& aOptions) {
CanonicalBrowsingContext* aContext, const nsCString& aRemoteType,
bool aReplaceBrowsingContext, uint64_t aSpecificGroupId) {
nsAutoCString currentRemoteType(NOT_REMOTE_TYPE);
if (RefPtr<ContentParent> contentParent = aContext->GetContentParent()) {
currentRemoteType = contentParent->GetRemoteType();
@ -1745,7 +1692,7 @@ void DocumentLoadListener::TriggerProcessSwitch(
MOZ_ASSERT_IF(currentRemoteType.IsEmpty(), !OtherPid());
LOG(("Process Switch: Changing Remoteness from '%s' to '%s'",
currentRemoteType.get(), aOptions.mRemoteType.get()));
currentRemoteType.get(), aRemoteType.get()));
// We're now committing to a process switch, so we can disconnect from
// the listeners in the old process.
@ -1763,7 +1710,9 @@ void DocumentLoadListener::TriggerProcessSwitch(
DisconnectListeners(NS_BINDING_ABORTED, NS_BINDING_ABORTED, true);
LOG(("Process Switch: Calling ChangeRemoteness"));
aContext->ChangeRemoteness(aOptions, mLoadIdentifier)
aContext
->ChangeRemoteness(aRemoteType, mLoadIdentifier, aReplaceBrowsingContext,
aSpecificGroupId)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[self = RefPtr{this}](BrowserParent* aBrowserParent) {

Просмотреть файл

@ -36,8 +36,7 @@
namespace mozilla {
namespace dom {
class CanonicalBrowsingContext;
struct RemotenessChangeOptions;
} // namespace dom
}
namespace net {
using ChildEndpointPromise =
MozPromise<ipc::Endpoint<extensions::PStreamFilterChild>, bool, true>;
@ -195,8 +194,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
// Looks up aLoadIdent to find the associated, cleans up the registration
static RefPtr<OpenPromise> ClaimParentLoad(DocumentLoadListener** aListener,
uint64_t aLoadIdent,
Maybe<uint64_t> aChannelId);
uint64_t aLoadIdent);
// Called by the DocumentChannelParent if actor got destroyed or the parent
// channel got deleted.
@ -322,7 +320,9 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
// and that the new remote type will be something other than NOT_REMOTE
bool MaybeTriggerProcessSwitch(bool* aWillSwitchToRemote);
void TriggerProcessSwitch(dom::CanonicalBrowsingContext* aContext,
const dom::RemotenessChangeOptions& aOptions);
const nsCString& aRemoteType,
bool aReplaceBrowsingContext,
uint64_t aSpecificGroupId);
// A helper for TriggerRedirectToRealChannel that abstracts over
// the same-process and cross-process switch cases and returns
@ -465,8 +465,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
nsCOMPtr<nsIChannel> mChannel;
Maybe<uint64_t> mDocumentChannelId;
// An instance of ParentChannelListener that we use as a listener
// between mChannel (and any future redirected mChannels) and us.
// This handles service worker interception, and retargetting

Просмотреть файл

@ -1245,9 +1245,6 @@ nsresult nsWindowWatcher::OpenWindowInternal(
}
if (uriToLoad && aNavigate) {
// XXXBFCache Per spec this should effectively use
// LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL when noopener is passed to
// window.open(). Bug 1694993.
loadState->SetLoadFlags(
windowIsNew
? static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD)

Просмотреть файл

@ -754,11 +754,6 @@ bool SessionHistoryInParent() {
fission_sessionHistoryInParent_AtStartup_DoNotUseDirectly();
}
bool BFCacheInParent() {
return SessionHistoryInParent() &&
StaticPrefs::fission_bfcacheInParent_DoNotUseDirectly();
}
} // namespace mozilla
/**

Просмотреть файл

@ -25,10 +25,6 @@ bool FissionAutostart();
// Returns true if fission.sessionHistoryInParent or FissionAutostart() is true.
bool SessionHistoryInParent();
// Returns true if SessionHistoryInParent() returns true and
// fission.bfcacheInParent is true.
bool BFCacheInParent();
}
%}