fix: Fixed crash on macos when quiting and glance opening a new window, b=bug #11416 and bug https://github.com/zen-browser/desktop/issues/11409, c=common, compact-mode, glance, tabs, workspaces

This commit is contained in:
mr. m
2025-11-27 16:43:51 +01:00
parent 1d36f05abc
commit 833caf2f81
8 changed files with 74 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 4b7232f3261f8589b734c2238170e6968d7ea0bf..d8c0b404724e9b0dc2b5a2d21420357586fb7f14 100644
index 4b7232f3261f8589b734c2238170e6968d7ea0bf..6c68a2e93b7287f92ff394789c50d1c10e8a36f2 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -84,6 +84,13 @@ ChromeUtils.defineLazyGetter(lazy, "logger", () =>
@@ -189,11 +189,13 @@ index 4b7232f3261f8589b734c2238170e6968d7ea0bf..d8c0b404724e9b0dc2b5a2d214203575
if (
event.keyCode == KeyEvent.DOM_VK_SHIFT ||
event.keyCode == KeyEvent.DOM_VK_ALT ||
@@ -3248,7 +3335,7 @@ export class UrlbarInput {
@@ -3247,8 +3334,8 @@ export class UrlbarInput {
if (!this.isAddressbar) {
return val;
}
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
- let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
- ? lazy.BrowserUIUtils.trimURL(val)
+ let trimmedValue = lazy.UrlbarPrefs.get("trimURLs") && this._zenTrimURL
+ ? this._zenTrimURL(val)
: val;
// Only trim value if the directionality doesn't change to RTL and we're not

View File

@@ -0,0 +1,19 @@
diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp
index daf10b9adb4b6a3c376edc5b0d8586e97483626a..415f64dbb2da5ea6da42f1ce29d6dc09cf86f713 100644
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1332,6 +1332,14 @@ void nsHttpTransaction::Close(nsresult reason) {
mDNSRequest = nullptr;
}
+ // If an HTTP/3 backup timer is active and this transaction ends in error,
+ // treat it as NS_ERROR_NET_RESET so the transaction will retry once.
+ // NOTE: This is a temporary workaround; the proper fix belongs in
+ // the Happy Eyeballs project.
+ if (NS_FAILED(reason) && mHttp3BackupTimerCreated && mHttp3BackupTimer) {
+ reason = NS_ERROR_NET_RESET;
+ }
+
MaybeCancelFallbackTimer();
MOZ_ASSERT(OnSocketThread(), "not on socket thread");

View File

@@ -45,9 +45,6 @@ let JSWINDOWACTORS = {
mousedown: {
capture: true,
},
mouseup: {
capture: true,
},
keydown: {
capture: true,
},

View File

@@ -52,9 +52,13 @@ window.gZenCompactModeManager = {
this._canDebugLog = Services.prefs.getBoolPref('zen.view.compact.debug', false);
this.addContextMenu();
this._resolvePreInit();
},
init() {
async init() {
await this._preInitPromise;
delete this._resolvePreInit;
delete this._preInitPromise;
this.addMouseActions();
const tabIsRightObserver = this._updateSidebarIsOnRight.bind(this);
@@ -227,6 +231,9 @@ window.gZenCompactModeManager = {
const isIllegalState = this.checkIfIllegalState();
const menuitem = document.getElementById('zen-context-menu-compact-mode-toggle');
const menu = document.getElementById('zen-context-menu-compact-mode');
if (!menu) {
return;
}
if (isSingleToolbar) {
menu.setAttribute('hidden', 'true');
menu.before(menuitem);
@@ -528,9 +535,11 @@ window.gZenCompactModeManager = {
},
updateContextMenu() {
document
.getElementById('zen-context-menu-compact-mode-toggle')
.setAttribute('checked', this.preference);
const toggle = document.getElementById('zen-context-menu-compact-mode-toggle');
if (!toggle) {
return;
}
toggle.setAttribute('checked', this.preference);
const hideTabBar = this.canHideSidebar;
const hideToolbar = this.canHideToolbar;
@@ -855,10 +864,13 @@ window.gZenCompactModeManager = {
},
};
document.addEventListener(
'MozBeforeInitialXULLayout',
() => {
gZenCompactModeManager.preInit();
},
{ once: true }
);
(gZenCompactModeManager._preInitPromise = new Promise((resolve) => {
gZenCompactModeManager._resolvePreInit = resolve;
})),
document.addEventListener(
'MozBeforeInitialXULLayout',
() => {
gZenCompactModeManager.preInit();
},
{ once: true }
);

View File

@@ -3,11 +3,9 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
export class ZenGlanceChild extends JSWindowActorChild {
#activationMethod;
#glanceTarget = null;
constructor() {
super();
this.mousemoveCallback = this.mousemoveCallback.bind(this);
}
async handleEvent(event) {
@@ -59,16 +57,32 @@ export class ZenGlanceChild extends JSWindowActorChild {
});
}
on_mousedown(event) {
/**
* Returns the closest A element from the event target
* and the element to record (originalTarget or target)
*/
#getTargetFromEvent(event) {
// get closest A element
const target = event.target.closest('A');
const elementToRecord = event.originalTarget || event.target;
return {
target,
elementToRecord,
};
}
on_mousedown(event) {
const { target, elementToRecord } = this.#getTargetFromEvent(event);
// We record the link data anyway, even if the glance may be invoked
// or not. We have some cases where glance would open, for example,
// when clicking on a link with a different domain where glance would open.
// The problem is that at that stage we don't know the rect or even what
// element has been clicked, so we send the data here.
this.#sendClickDataToParent(target, elementToRecord);
}
on_click(event) {
const { target } = this.#getTargetFromEvent(event);
if (event.button !== 0 || event.defaultPrevented || this.#ensureOnlyKeyModifiers(event)) {
return;
}
@@ -82,31 +96,9 @@ export class ZenGlanceChild extends JSWindowActorChild {
} else if (activationMethod === 'meta' && !event.metaKey) {
return;
}
this.#glanceTarget = target;
this.contentWindow.addEventListener('mousemove', this.mousemoveCallback, { once: true });
}
on_mouseup() {
if (this.#glanceTarget) {
// Don't clear the glance target here, we need it in the click handler
// See issue https://github.com/zen-browser/desktop/issues/11409
this.#openGlance(this.#glanceTarget);
}
this.contentWindow.removeEventListener('mousemove', this.mousemoveCallback);
}
on_click(event) {
if (this.#glanceTarget) {
event.preventDefault();
event.stopPropagation();
this.#glanceTarget = null;
}
}
mousemoveCallback() {
if (this.#glanceTarget) {
this.#glanceTarget = null;
}
event.preventDefault();
event.stopPropagation();
this.#openGlance(target);
}
on_keydown(event) {

View File

@@ -164,7 +164,7 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
if (init) {
this._hasFinishedLoading = true;
}
}, 10);
}, 100);
}
async #initializePinsCache() {

View File

@@ -51,7 +51,11 @@ class nsZenWorkspaces extends nsZenMultiWindowFeature {
if (this.privateWindowOrDisabled) {
return;
}
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized]);
await Promise.all([
this.promiseDBInitialized,
this.promisePinnedInitialized,
SessionStore.promiseAllWindowsRestored,
]);
}
async init() {

View File

@@ -19,7 +19,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.17.10b",
"displayVersion": "1.17.11b",
"github": {
"repo": "zen-browser/desktop"
},