Bug 1656997 - When session history runs in the parent process, SessionStore should not modify the session history when doing process switches, r=nika,mconley

Differential Revision: https://phabricator.services.mozilla.com/D86073
This commit is contained in:
Olli Pettay 2020-08-14 15:27:26 +00:00
Родитель cadcd14bc8
Коммит 0352eecee9
2 изменённых файлов: 27 добавлений и 11 удалений

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

@ -29,6 +29,12 @@
"UrlbarProviderOpenTabs", "UrlbarProviderOpenTabs",
"resource:///modules/UrlbarProviderOpenTabs.jsm" "resource:///modules/UrlbarProviderOpenTabs.jsm"
); );
XPCOMUtils.defineLazyPreferenceGetter(
this,
"sessionHistoryInParent",
"fission.sessionHistoryInParent",
false
);
Services.obs.addObserver(this, "contextual-identity-updated"); Services.obs.addObserver(this, "contextual-identity-updated");
@ -1979,8 +1985,10 @@
// Ensure that SessionStore has flushed any session history state from the // Ensure that SessionStore has flushed any session history state from the
// content process before we this browser's remoteness. // content process before we this browser's remoteness.
b.prepareToChangeRemoteness = () => if (!this.sessionHistoryInParent) {
SessionStore.prepareToChangeRemoteness(b); b.prepareToChangeRemoteness = () =>
SessionStore.prepareToChangeRemoteness(b);
}
const defaultBrowserAttributes = { const defaultBrowserAttributes = {
contextmenu: "contentAreaContextMenu", contextmenu: "contentAreaContextMenu",

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

@ -18,6 +18,10 @@
"resource://gre/modules/BrowserUtils.jsm" "resource://gre/modules/BrowserUtils.jsm"
); );
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
let LazyModules = {}; let LazyModules = {};
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(
@ -44,10 +48,12 @@
"resource://gre/actors/PopupBlockingParent.jsm" "resource://gre/actors/PopupBlockingParent.jsm"
); );
ChromeUtils.defineModuleGetter( let lazyPrefs = {};
LazyModules, XPCOMUtils.defineLazyPreferenceGetter(
"XPCOMUtils", lazyPrefs,
"resource://gre/modules/XPCOMUtils.jsm" "sessionHistoryInParent",
"fission.sessionHistoryInParent",
false
); );
const elementsToDestroyOnUnload = new Set(); const elementsToDestroyOnUnload = new Set();
@ -90,7 +96,7 @@
// between calls to destroy(). // between calls to destroy().
this.progressListeners = []; this.progressListeners = [];
LazyModules.XPCOMUtils.defineLazyGetter(this, "popupBlocker", () => { XPCOMUtils.defineLazyGetter(this, "popupBlocker", () => {
return new LazyModules.PopupBlocker(this); return new LazyModules.PopupBlocker(this);
}); });
@ -1872,10 +1878,12 @@
// history, and performing the `resumeRedirectedLoad`, in order to get // history, and performing the `resumeRedirectedLoad`, in order to get
// sesssion state set up correctly. // sesssion state set up correctly.
// FIXME: This probably needs to be hookable by GeckoView. // FIXME: This probably needs to be hookable by GeckoView.
let tabbrowser = this.getTabBrowser(); if (!lazyPrefs.sessionHistoryInParent) {
if (tabbrowser) { let tabbrowser = this.getTabBrowser();
tabbrowser.finishBrowserRemotenessChange(this, redirectLoadSwitchId); if (tabbrowser) {
return true; tabbrowser.finishBrowserRemotenessChange(this, redirectLoadSwitchId);
return true;
}
} }
return false; return false;
} }