diff --git a/src/browser/base/content/zen-keysets.inc.xhtml b/src/browser/base/content/zen-keysets.inc.xhtml index 2e8122fb5..9844aa332 100644 --- a/src/browser/base/content/zen-keysets.inc.xhtml +++ b/src/browser/base/content/zen-keysets.inc.xhtml @@ -4,4 +4,10 @@ #include zen-commands.inc.xhtml - + +# Prefetch these keys because they are being used by the native menu bar +# and they need to be available even before the XUL is fully loaded and +# our KBS sysmtem is initialized. + + + diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index 659e66117..91a624a4a 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -599,19 +599,6 @@ class nsZenWindowSync { if (aOurTab.linkedBrowser.isRemoteBrowser != aOtherTab.linkedBrowser.isRemoteBrowser) { return false; } - // Load about:blank if by any chance we loaded the previous tab's URL. - // TODO: We should maybe start using a singular about:blank preloaded view - // to avoid loading a full blank page each time and wasting resources. - // We do need to do this though instead of just unloading the browser because - // firefox doesn't expect an unloaded + selected tab, so we need to get - // around this limitation somehow. - if (!onClose && aOurTab.linkedBrowser?.currentURI.spec !== 'about:blank') { - this.log(`Loading about:blank in our tab ${aOurTab.id} before swap`); - aOurTab.linkedBrowser.loadURI(Services.io.newURI('about:blank'), { - triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), - loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY, - }); - } // Running `swapBrowsersAndCloseOther` doesn't expect us to use the tab after // the operation, so it doesn't really care about cleaning up the other tab. // We need to make a new tab progress listener for the other tab after the swap. @@ -623,7 +610,7 @@ class nsZenWindowSync { // Sometimes, when closing a window for example, when we swap the browsers, // there's a chance that the tab does not have the entries state moved over properly. // To avoid losing history entries, we have to keep the permanentKey in sync. - this.#makeSureTabSyncsPermanentKey(aOtherTab); + this.#makeSureTabSyncsPermanentKey(aOurTab); // Since we are moving progress listeners around, there's a chance that we // trigger a load while making the switch, and since we remove the previous // tab's listeners, the other browser window will never get the 'finish load' event @@ -633,6 +620,19 @@ class nsZenWindowSync { if (!aOtherTab.hasAttribute('busy')) { aOurTab.removeAttribute('busy'); } + // Load about:blank if by any chance we loaded the previous tab's URL. + // TODO: We should maybe start using a singular about:blank preloaded view + // to avoid loading a full blank page each time and wasting resources. + // We do need to do this though instead of just unloading the browser because + // firefox doesn't expect an unloaded + selected tab, so we need to get + // around this limitation somehow. + if (!onClose && aOtherTab.linkedBrowser?.currentURI.spec !== 'about:blank') { + this.log(`Loading about:blank in our tab ${aOtherTab.id} before swap`); + aOtherTab.linkedBrowser.loadURI(Services.io.newURI('about:blank'), { + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), + loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY, + }); + } }, onClose ); diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index 7076daaf8..89a07a283 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -256,7 +256,11 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { // tab copy or move draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); // not our drop then - if (!gBrowser.isTab(draggedTab) || gBrowser.selectedTab.hasAttribute('zen-empty-tab')) { + if ( + !gBrowser.isTab(draggedTab) || + gBrowser.selectedTab.hasAttribute('zen-empty-tab') || + draggedTab.ownerGlobal !== window + ) { return; } gBrowser.tabContainer.tabDragAndDrop.finishMoveTogetherSelectedTabs(draggedTab);