Bug 1665710: don't update session history for about:blank transient pages r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D90589
This commit is contained in:
Randell Jesup 2020-09-22 16:54:56 +00:00
Родитель 4f05d51b11
Коммит 594f5b5808
4 изменённых файлов: 18 добавлений и 5 удалений

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

@ -39,6 +39,7 @@
using namespace mozilla::ipc;
extern mozilla::LazyLogModule gAutoplayPermissionLog;
extern mozilla::LazyLogModule gSHLog;
#define AUTOPLAY_LOG(msg, ...) \
MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
@ -354,6 +355,9 @@ CanonicalBrowsingContext::CreateLoadingSessionHistoryEntryForLoad(
aLoadState->GetLoadingSessionHistoryInfo();
if (existingLoadingInfo) {
entry = SessionHistoryEntry::GetByLoadId(existingLoadingInfo->mLoadId);
MOZ_LOG(gSHLog, LogLevel::Verbose,
("SHEntry::GetByLoadId(%" PRIu64 ") -> %p",
existingLoadingInfo->mLoadId, entry.get()));
} else {
entry = new SessionHistoryEntry(aLoadState, aChannel);
if (IsTop()) {

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

@ -280,7 +280,7 @@ static mozilla::LazyLogModule gDocShellAndDOMWindowLeakLogging(
#endif
static mozilla::LazyLogModule gDocShellLeakLog("nsDocShellLeak");
extern mozilla::LazyLogModule gPageCacheLog;
static mozilla::LazyLogModule gSHLog("SessionHistory");
mozilla::LazyLogModule gSHLog("SessionHistory");
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
const char kAppstringsBundleURL[] =
@ -5689,7 +5689,8 @@ nsresult nsDocShell::RefreshURIFromQueue() {
}
nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
WindowGlobalChild* aWindowActor) {
WindowGlobalChild* aWindowActor,
bool aIsTransientAboutBlank) {
// Save the LayoutHistoryState of the previous document, before
// setting up new document
PersistLayoutHistoryState();
@ -5714,7 +5715,8 @@ nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
SetHistoryEntryAndUpdateBC(Nothing(), Some<nsISHEntry*>(mLSHE));
}
if (StaticPrefs::fission_sessionHistoryInParent()) {
if (!aIsTransientAboutBlank &&
StaticPrefs::fission_sessionHistoryInParent()) {
MOZ_LOG(gSHLog, LogLevel::Debug, ("document %p Embed", this));
MoveLoadingToActiveEntry(mLoadType != LOAD_ERROR_PAGE);
}
@ -6764,7 +6766,7 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
// hook 'em up
if (viewer) {
viewer->SetContainer(this);
rv = Embed(viewer, aActor);
rv = Embed(viewer, aActor, true);
NS_ENSURE_SUCCESS(rv, rv);
SetCurrentURI(blankDoc->GetDocumentURI(), nullptr, true, 0);

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

@ -1009,7 +1009,8 @@ class nsDocShell final : public nsDocLoader,
nsresult EnsureCommandHandler();
nsresult RefreshURIFromQueue();
nsresult Embed(nsIContentViewer* aContentViewer,
mozilla::dom::WindowGlobalChild* aWindowActor = nullptr);
mozilla::dom::WindowGlobalChild* aWindowActor = nullptr,
bool aIsTransientAboutBlank = false);
nsPresContext* GetEldestPresContext();
nsresult CheckLoadingPermissions();
nsresult LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType);

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

@ -13,6 +13,8 @@
#include "mozilla/dom/nsCSPContext.h"
#include "mozilla/ipc/IPDLParamTraits.h"
extern mozilla::LazyLogModule gSHLog;
namespace mozilla {
namespace dom {
@ -264,6 +266,8 @@ LoadingSessionHistoryInfo::LoadingSessionHistoryInfo(
SessionHistoryEntry::sLoadIdToEntry =
new nsDataHashtable<nsUint64HashKey, SessionHistoryEntry*>();
}
MOZ_LOG(gSHLog, LogLevel::Verbose,
("SHEntry::AddLoadId(%" PRIu64 " - %p", mLoadId, aEntry));
SessionHistoryEntry::sLoadIdToEntry->Put(mLoadId, aEntry);
}
@ -303,6 +307,8 @@ void SessionHistoryEntry::RemoveLoadId(uint64_t aLoadId) {
return;
}
MOZ_LOG(gSHLog, LogLevel::Verbose,
("SHEntry::RemoveLoadId(%" PRIu64 ")", aLoadId));
sLoadIdToEntry->Remove(aLoadId);
}