diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 43154d8d642e..88deaa7a8950 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -29,6 +29,12 @@ "UrlbarProviderOpenTabs", "resource:///modules/UrlbarProviderOpenTabs.jsm" ); + XPCOMUtils.defineLazyPreferenceGetter( + this, + "sessionHistoryInParent", + "fission.sessionHistoryInParent", + false + ); Services.obs.addObserver(this, "contextual-identity-updated"); @@ -1979,8 +1985,10 @@ // Ensure that SessionStore has flushed any session history state from the // content process before we this browser's remoteness. - b.prepareToChangeRemoteness = () => - SessionStore.prepareToChangeRemoteness(b); + if (!this.sessionHistoryInParent) { + b.prepareToChangeRemoteness = () => + SessionStore.prepareToChangeRemoteness(b); + } const defaultBrowserAttributes = { contextmenu: "contentAreaContextMenu", diff --git a/toolkit/content/widgets/browser-custom-element.js b/toolkit/content/widgets/browser-custom-element.js index cbfebf97cf22..c1b917104d3e 100644 --- a/toolkit/content/widgets/browser-custom-element.js +++ b/toolkit/content/widgets/browser-custom-element.js @@ -18,6 +18,10 @@ "resource://gre/modules/BrowserUtils.jsm" ); + const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" + ); + let LazyModules = {}; ChromeUtils.defineModuleGetter( @@ -44,10 +48,12 @@ "resource://gre/actors/PopupBlockingParent.jsm" ); - ChromeUtils.defineModuleGetter( - LazyModules, - "XPCOMUtils", - "resource://gre/modules/XPCOMUtils.jsm" + let lazyPrefs = {}; + XPCOMUtils.defineLazyPreferenceGetter( + lazyPrefs, + "sessionHistoryInParent", + "fission.sessionHistoryInParent", + false ); const elementsToDestroyOnUnload = new Set(); @@ -90,7 +96,7 @@ // between calls to destroy(). this.progressListeners = []; - LazyModules.XPCOMUtils.defineLazyGetter(this, "popupBlocker", () => { + XPCOMUtils.defineLazyGetter(this, "popupBlocker", () => { return new LazyModules.PopupBlocker(this); }); @@ -1872,10 +1878,12 @@ // history, and performing the `resumeRedirectedLoad`, in order to get // sesssion state set up correctly. // FIXME: This probably needs to be hookable by GeckoView. - let tabbrowser = this.getTabBrowser(); - if (tabbrowser) { - tabbrowser.finishBrowserRemotenessChange(this, redirectLoadSwitchId); - return true; + if (!lazyPrefs.sessionHistoryInParent) { + let tabbrowser = this.getTabBrowser(); + if (tabbrowser) { + tabbrowser.finishBrowserRemotenessChange(this, redirectLoadSwitchId); + return true; + } } return false; }