From def0ed7a525fcc455a8c41d20ebbf60f79a7da5e Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Mon, 5 May 2025 20:10:48 +0200 Subject: [PATCH] fix: Fixed essentials content not loading, b=(closes #8039), c=common, tabs --- .../urlbar/UrlbarInput-sys-mjs.patch | 29 ++++++++++--------- src/zen/common/ZenStartup.mjs | 9 +++--- src/zen/common/ZenUIManager.mjs | 6 ++++ src/zen/tabs/ZenPinnedTabManager.mjs | 7 +++-- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch b/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch index 2df44be9..954d1025 100644 --- a/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch +++ b/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs -index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec4864aad73f5 100644 +index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..a05dfd9b28c0c082579a5b53386de9ffbfc5e737 100644 --- a/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs @@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter( @@ -86,19 +86,20 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 startLayoutExtend() { if (!this.#allowBreakout || this.hasAttribute("breakout-extend")) { // Do not expand if the Urlbar does not support being expanded or it is -@@ -2147,6 +2183,11 @@ export class UrlbarInput { +@@ -2147,6 +2183,12 @@ export class UrlbarInput { this.setAttribute("breakout-extend", "true"); + if (lazy.ZEN_URLBAR_BEHAVIOR == 'float' || (lazy.ZEN_URLBAR_BEHAVIOR == 'floating-on-type' && !this.focusedViaMousedown)) { + this.setAttribute("zen-floating-urlbar", "true"); ++ this.window.gZenUIManager.onFloatingURLBarOpen(); + } else { + this.removeAttribute("zen-floating-urlbar"); + } // Enable the animation only after the first extend call to ensure it // doesn't run when opening a new window. if (!this.hasAttribute("breakout-extend-animate")) { -@@ -2166,6 +2207,24 @@ export class UrlbarInput { +@@ -2166,6 +2208,24 @@ export class UrlbarInput { return; } @@ -123,7 +124,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 this.removeAttribute("breakout-extend"); this.#updateTextboxPosition(); } -@@ -2485,7 +2544,7 @@ export class UrlbarInput { +@@ -2485,7 +2545,7 @@ export class UrlbarInput { this.textbox.parentNode.style.setProperty( "--urlbar-container-height", @@ -132,7 +133,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 ); this.textbox.style.setProperty( "--urlbar-height", -@@ -2998,7 +3057,7 @@ export class UrlbarInput { +@@ -2998,7 +3058,7 @@ export class UrlbarInput { */ _trimValue(val) { let trimmedValue = lazy.UrlbarPrefs.get("trimURLs") @@ -141,7 +142,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 : val; // Only trim value if the directionality doesn't change to RTL and we're not // showing a strikeout https protocol. -@@ -3368,6 +3427,10 @@ export class UrlbarInput { +@@ -3368,6 +3428,10 @@ export class UrlbarInput { } reuseEmpty = true; } @@ -152,7 +153,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 if ( where == "tab" && reuseEmpty && -@@ -3375,6 +3438,9 @@ export class UrlbarInput { +@@ -3375,6 +3439,9 @@ export class UrlbarInput { ) { where = "current"; } @@ -162,7 +163,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 return where; } -@@ -3632,6 +3698,7 @@ export class UrlbarInput { +@@ -3632,6 +3699,7 @@ export class UrlbarInput { this.setResultForCurrentValue(null); this.handleCommand(); this.controller.clearLastQueryContextCache(); @@ -170,7 +171,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 this._suppressStartQuery = false; }); -@@ -3639,7 +3706,6 @@ export class UrlbarInput { +@@ -3639,7 +3707,6 @@ export class UrlbarInput { contextMenu.addEventListener("popupshowing", () => { // Close the results pane when the input field contextual menu is open, // because paste and go doesn't want a result selection. @@ -178,7 +179,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 let controller = this.document.commandDispatcher.getControllerForCommand("cmd_paste"); -@@ -4053,6 +4119,11 @@ export class UrlbarInput { +@@ -4053,6 +4120,11 @@ export class UrlbarInput { } _on_click(event) { @@ -190,7 +191,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 if ( event.target == this.inputField || event.target == this._inputContainer || -@@ -4124,7 +4195,7 @@ export class UrlbarInput { +@@ -4124,7 +4196,7 @@ export class UrlbarInput { } } @@ -199,7 +200,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 this.view.autoOpen({ event }); } else { if (this._untrimOnFocusAfterKeydown) { -@@ -4164,9 +4235,12 @@ export class UrlbarInput { +@@ -4164,9 +4236,12 @@ export class UrlbarInput { } _on_mousedown(event) { @@ -213,7 +214,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 if ( event.target != this.inputField && -@@ -4176,8 +4250,8 @@ export class UrlbarInput { +@@ -4176,8 +4251,8 @@ export class UrlbarInput { break; } @@ -224,7 +225,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec486 // Keep the focus status, since the attribute may be changed // upon calling this.focus(). -@@ -4218,7 +4292,7 @@ export class UrlbarInput { +@@ -4218,7 +4293,7 @@ export class UrlbarInput { } // Don't close the view when clicking on a tab; we may want to keep the // view open on tab switch, and the TabSelect event arrived earlier. diff --git a/src/zen/common/ZenStartup.mjs b/src/zen/common/ZenStartup.mjs index 14a75b95..80364024 100644 --- a/src/zen/common/ZenStartup.mjs +++ b/src/zen/common/ZenStartup.mjs @@ -64,14 +64,15 @@ setTimeout(() => { gZenCompactModeManager.init(); setTimeout(() => { - // A bit of a hack to make sure the tabs toolbar is updated. - // Just in case we didn't get the right size. - gZenUIManager.updateTabsToolbar(); - // Fix for https://github.com/zen-browser/desktop/issues/7605, specially in compact mode if (gURLBar.hasAttribute('breakout-extend')) { gURLBar.focus(); } + setTimeout(() => { + // A bit of a hack to make sure the tabs toolbar is updated. + // Just in case we didn't get the right size. + gZenUIManager.updateTabsToolbar(); + }, 0); }, 100); }, 0); this.closeWatermark(); diff --git a/src/zen/common/ZenUIManager.mjs b/src/zen/common/ZenUIManager.mjs index 9396914c..c43a6f4b 100644 --- a/src/zen/common/ZenUIManager.mjs +++ b/src/zen/common/ZenUIManager.mjs @@ -80,6 +80,12 @@ var gZenUIManager = { } }, + onFloatingURLBarOpen() { + requestAnimationFrame(() => { + this.updateTabsToolbar(); + }); + }, + openAndChangeToTab(url, options) { if (window.ownerGlobal.parent) { const tab = window.ownerGlobal.parent.gBrowser.addTrustedTab(url, options); diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 9a056ddd..94b69370 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -587,7 +587,7 @@ const foundEntryIndex = state.entries?.findIndex((entry) => entry.url === pin.url); if (foundEntryIndex === -1) { state.entries = [ - [state.entries[0]] ?? { + { url: pin.url, title: pin.title, triggeringPrincipal_base64: lazy.E10SUtils.SERIALIZED_SYSTEMPRINCIPAL, @@ -597,7 +597,6 @@ // Remove everything except the entry we want to keep state.entries = [state.entries[foundEntryIndex]]; } - state.image = pin.iconUrl || null; state.index = 0; @@ -666,7 +665,9 @@ gBrowser.pinTab(tab); } tab.setAttribute('zenDefaultUserContextId', true); - ZenWorkspaces.switchTabIfNeeded(tab); + if (tab.selected) { + ZenWorkspaces.switchTabIfNeeded(tab); + } this._onTabMove(tab); this.onTabIconChanged(tab);