Bug 1649131 - Stop checking for an nsISHEntry in nsDocShellLoadState as a sign of a load from history. r=smaug

Checking for an nsISHEntry doesn't work anymore with session history in the
parent. For that we can check that the loading session history info's
mIsLoadFromSessionHistory is true. If there is no loading session history info
we can fall back to the old way of checking for a non-null nsISHEntry (which
will only ever be true if session history in the parent is turned off).

Differential Revision: https://phabricator.services.mozilla.com/D87037
This commit is contained in:
Peter Van der Beken
2020-08-23 20:20:55 +00:00
parent 5a377e2136
commit fe202df43d
5 changed files with 77 additions and 57 deletions

View File

@@ -530,12 +530,25 @@ nsDocShellLoadState::GetLoadingSessionHistoryInfo() const {
void nsDocShellLoadState::SetLoadIsFromSessionHistory(
int32_t aRequestedIndex, int32_t aSessionHistoryLength) {
if (mLoadingSessionHistoryInfo) {
mLoadingSessionHistoryInfo->mIsLoadFromSessionHistory = true;
mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory = true;
mLoadingSessionHistoryInfo->mRequestedIndex = aRequestedIndex;
mLoadingSessionHistoryInfo->mSessionHistoryLength = aSessionHistoryLength;
}
}
void nsDocShellLoadState::ClearLoadIsFromSessionHistory() {
if (mLoadingSessionHistoryInfo) {
mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory = false;
}
mSHEntry = nullptr;
}
bool nsDocShellLoadState::LoadIsFromSessionHistory() const {
return mLoadingSessionHistoryInfo
? mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory
: !!mSHEntry;
}
const nsString& nsDocShellLoadState::Target() const { return mTarget; }
void nsDocShellLoadState::SetTarget(const nsAString& aTarget) {