Bug 1736570 - Avoid DocumentChannel for nsParser-created initial about:blank replacement. r=nika,smaug

Differential Revision: https://phabricator.services.mozilla.com/D135106
This commit is contained in:
Henri Sivonen
2022-02-17 13:27:15 +00:00
parent 9fbf9d7b4c
commit 81ebfedbf3
13 changed files with 196 additions and 47 deletions

View File

@@ -501,7 +501,8 @@ class nsDocShell final : public nsDocLoader,
mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType);
void SetLoadingSessionHistoryInfo(
const mozilla::dom::LoadingSessionHistoryInfo& aLoadingInfo);
const mozilla::dom::LoadingSessionHistoryInfo& aLoadingInfo,
bool aNeedToReportActiveAfterLoadingBecomesActive = false);
const mozilla::dom::LoadingSessionHistoryInfo*
GetLoadingSessionHistoryInfo() {
return mLoadingEntry.get();
@@ -675,6 +676,12 @@ class nsDocShell final : public nsDocLoader,
nsIURI* aCurrentURI, nsIReferrerInfo* aReferrerInfo,
bool aNotifiedBeforeUnloadListeners = false);
public:
bool IsAboutBlankLoadOntoInitialAboutBlank(nsIURI* aURI,
bool aInheritPrincipal,
nsIPrincipal* aPrincipalToInherit);
private:
//
// URI Load
//
@@ -1213,7 +1220,9 @@ class nsDocShell final : public nsDocLoader,
// These are only set when fission.sessionHistoryInParent is set.
mozilla::UniquePtr<mozilla::dom::SessionHistoryInfo> mActiveEntry;
bool mActiveEntryIsLoadingFromSessionHistory = false;
// mLoadingEntry is set when we're about to start loading.
// mLoadingEntry is set when we're about to start loading. Whenever
// setting mLoadingEntry, be sure to also set
// mNeedToReportActiveAfterLoadingBecomesActive.
mozilla::UniquePtr<mozilla::dom::LoadingSessionHistoryInfo> mLoadingEntry;
// Holds a weak pointer to a RestorePresentationEvent object if any that
@@ -1362,6 +1371,12 @@ class nsDocShell final : public nsDocLoader,
* a possible history load. Used only with iframes.
*/
bool mCheckingSessionHistory : 1;
// Whether mBrowsingContext->SetActiveSessionHistoryEntry() needs to be called
// when the loading entry becomes the active entry. This is used for the
// initial about:blank-replacing about:blank in order to make the history
// length WPTs pass.
bool mNeedToReportActiveAfterLoadingBecomesActive : 1;
};
inline nsISupports* ToSupports(nsDocShell* aDocShell) {