Compare commits

..

1 Commits

Author SHA1 Message Date
mr. m
0541ac2ad0 closes #14331: Refactor SR to support container tab forcing 2026-06-22 12:13:52 +02:00
32 changed files with 239 additions and 1008 deletions

View File

@@ -34,8 +34,8 @@ Zen is a firefox-based browser with the aim of pushing your productivity to a ne
### Firefox Versions
- [`Release`](https://zen-browser.app/download) - Is currently built using Firefox version `152.0.4`! 🚀
- [`Twilight`](https://zen-browser.app/download?twilight) - Is currently built using Firefox version `RC 152.0.4`!
- [`Release`](https://zen-browser.app/download) - Is currently built using Firefox version `152.0.1`! 🚀
- [`Twilight`](https://zen-browser.app/download?twilight) - Is currently built using Firefox version `RC 152.0.1`!
### Contributing

View File

@@ -1 +1 @@
3985a970489e32fc751e1b80abf4d5534c905e45
2960f4c1ce58d289d3b9ec885695f0017d2636ab

View File

@@ -6,13 +6,13 @@ zen-folders-search-placeholder =
.placeholder = Search { $folder-name }...
zen-folders-panel-rename-folder =
.label = Rename Folder
.label = Rename Folder
zen-folders-panel-unpack-folder =
.label = Unpack Folder
zen-folders-new-subfolder =
.label = New Subfolder
.label = New Subfolder
zen-folders-panel-delete-folder =
.label = Delete Folder
@@ -21,7 +21,7 @@ zen-folders-panel-convert-folder-to-space =
.label = Convert folder to Space
zen-folders-panel-change-folder-space =
.label = Change Space
.label = Change Space...
zen-folders-unload-all-tooltip =
.tooltiptext = Unload active in this folder

View File

@@ -19,23 +19,17 @@ tab-context-zen-add-essential-badge = { $num } / { $max }
tab-context-zen-remove-essential =
.label = Remove from Essentials
.accesskey = R
tab-context-zen-edit-pinned-page =
tab-context-zen-replace-pinned-url-with-current =
.label =
{ $isEssential ->
[true] Edit Essential URL
*[false] Edit Pinned URL
[true] Replace Essential URL with Current
*[false] Replace Pinned URL with Current
}
.accesskey = P
tab-context-zen-replace-pinned-url-with-current =
.label = Replace with Current URL
.accesskey = C
tab-context-zen-edit-pinned-url =
.label = Edit…
.accesskey = E
tab-context-zen-edit-title =
.label = Change Label
.label = Change Label...
tab-context-zen-edit-icon =
.label = Change Icon
.label = Change Icon...
zen-themes-corrupted = Your { -brand-short-name } mods file is corrupted. They have been reset to the default theme.
zen-shortcuts-corrupted = Your { -brand-short-name } shortcuts file is corrupted. They have been reset to the default shortcuts.
@@ -61,10 +55,6 @@ zen-general-confirm =
.label = Confirm
zen-pinned-tab-replaced = Pinned tab URL has been replaced with the current URL!
zen-pinned-tab-url-edited = Pinned tab URL has been updated!
zen-pinned-tab-url-invalid = That doesn't look like a valid URL.
zen-pinned-tab-edit-url-title = Edit Pinned URL
zen-pinned-tab-edit-url-label = Enter the URL this pinned tab should point to:
zen-tabs-renamed = Tab has been successfully renamed!
zen-background-tab-opened-toast = New background tab opened!
zen-workspace-renamed-toast = Workspace has been successfully renamed!

View File

@@ -25,9 +25,3 @@ zen-space-routing-open-in = Open In
zen-space-routing-url = URL
zen-space-routing-tab-routed-toast = New tab opened in { $targetWorkspace }
tab-context-zen-add-domain-to-sr =
.label =
{ $tabCount ->
[one] Add Route for Domain
*[other] Add Route for Domains
}

View File

@@ -20,7 +20,7 @@ zen-toolbar-context-compact-mode-hide-both =
.accesskey = H
zen-toolbar-context-move-to-folder =
.label = Move to Folder
.label = Move to Folder...
.accesskey = M
zen-toolbar-context-new-folder =
@@ -31,7 +31,7 @@ sidebar-zen-expand =
.label = Expand Sidebar
sidebar-zen-create-new =
.label = Create New
.label = Create New...
tabbrowser-unload-tab-button =
.tooltiptext =

View File

@@ -24,10 +24,10 @@ zen-workspaces-panel-context-delete =
.accesskey = D
zen-workspaces-panel-change-name =
.label = Change Name
.label = Change Name
zen-workspaces-panel-change-icon =
.label = Change Icon
.label = Change Icon
zen-workspaces-panel-context-default-profile =
.label = Set Profile
@@ -42,7 +42,7 @@ zen-workspaces-how-to-reorder-title = How to reorder spaces
zen-workspaces-how-to-reorder-desc = Drag the space icons at the bottom of the sidebar to reorder them
zen-workspaces-change-theme =
.label = Edit Theme
.label = Edit Theme
zen-workspaces-panel-context-open =
.label = Open Workspace
@@ -72,7 +72,7 @@ zen-workspace-creation-name =
.placeholder = Space Name
zen-move-tab-to-workspace-button =
.label = Move To
.label = Move To...
.tooltiptext = Move all tabs in this window to a Space
zen-workspaces-panel-context-reorder =

View File

@@ -10,6 +10,7 @@
"build": "surfer build",
"build:ui": "surfer build --ui",
"start": "cd engine && python3 ./mach run --noprofile",
"start:debug": "npm start -- --jsdebugger --wait-for-jsdebugger",
"start:bloat": "XPCOM_MEM_BLOAT_LOG=1 npm start",
"import": "npm run ffprefs && npm run import:dumps && surfer import",
"import:dumps": "python3 scripts/update_service_dumps.py",

View File

@@ -23,6 +23,3 @@
- name: browser.ml.linkPreview.enabled
value: false
- name: browser.preferences.aiControls
value: false

View File

@@ -1,18 +0,0 @@
diff --git a/browser/base/content/aboutDialog.css b/browser/base/content/aboutDialog.css
index 017125bc2510e5f5e317a5e78c40d6aa9ded76ca..d343d8c62a2251e3c3a33ae8f2ab9c4c68218c22 100644
--- a/browser/base/content/aboutDialog.css
+++ b/browser/base/content/aboutDialog.css
@@ -135,6 +135,13 @@
margin: 0 40px;
}
+#trademark {
+ font-size: xx-small;
+ text-align: center;
+ margin-block: 10px;
+ color: var(--text-color-deemphasized);
+}
+
#currentChannel {
margin: 0;
padding: 0;

View File

@@ -1,5 +1,5 @@
diff --git a/browser/base/content/aboutDialog.xhtml b/browser/base/content/aboutDialog.xhtml
index 3ffd464b960a4299a7dd0cd87e4fc2f781b9d593..7a831c8ee2b73bb89bf8a82ac24958b55c16a5aa 100644
index 3ffd464b960a4299a7dd0cd87e4fc2f781b9d593..ef9f42d1f0196902b4af31f4496891fcd6319831 100644
--- a/browser/base/content/aboutDialog.xhtml
+++ b/browser/base/content/aboutDialog.xhtml
@@ -102,10 +102,6 @@
@@ -39,8 +39,8 @@ index 3ffd464b960a4299a7dd0cd87e4fc2f781b9d593..7a831c8ee2b73bb89bf8a82ac24958b5
<label is="text-link" class="bottom-link" useoriginprincipal="true" href="about:license" data-l10n-id="bottomLinks-license"/>
- <label is="text-link" class="bottom-link" href="https://www.mozilla.org/about/legal/terms/firefox/" data-l10n-id="bottom-links-terms"/>
- <label is="text-link" class="bottom-link" href="https://www.mozilla.org/privacy/firefox/?utm_source=firefox-browser&#38;utm_medium=firefox-desktop&#38;utm_campaign=about-dialog" data-l10n-id="bottom-links-privacy"/>
+ <label is="text-link" class="bottom-link" href="about:rights" data-l10n-id="bottom-links-terms"/>
+ <label is="text-link" class="bottom-link" href="https://www.zen-browser.app/privacy-policy/" data-l10n-id="bottom-links-privacy"/>
+ <label is="text-link" class="bottom-link" href="about:rights" data-l10n-id="bottomLinks-rights"/>
+ <label is="text-link" class="bottom-link" href="https://www.zen-browser.app/privacy-policy/" data-l10n-id="bottomLinks-privacy"/>
</hbox>
<description id="trademark" data-l10n-id="trademarkInfo"></description>
</vbox>

View File

@@ -35,7 +35,6 @@
<command id="cmd_zenToggleTabsOnRight" />
<command id="cmd_zenReplacePinnedUrlWithCurrent" />
<command id="cmd_zenEditPinnedUrl" />
<command id="cmd_contextZenAddToEssentials" />
<command id="cmd_contextZenRemoveFromEssentials" />

View File

@@ -10,7 +10,7 @@ index 57add34d876fb885275f1147209c6fbeee367a7c..be0ab43b299317c0022a5e719f47a070
],
resizeCallback: async ({ title, frame }) => {
// Search within main document and highlight matched keyword.
@@ -437,6 +437,8 @@ const CONFIG_PANES = Object.freeze({
@@ -437,6 +438,8 @@ const CONFIG_PANES = Object.freeze({
tabsBrowsing: {
l10nId: "tabs-browsing-section",
groupIds: [

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb992510fa 100644
index 08b5b56e069d038d72c87355920c4ce8a55ed805..99b3de9a7be5cd5fd73c0b9dbbe265655d7171ce 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -511,6 +511,7 @@
@@ -109,13 +109,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
tab.linkedPanel = uniqueId;
this._selectedTab = tab;
this._selectedBrowser = browser;
@@ -1126,18 +1187,24 @@
aTab,
{ telemetrySource = this.TabMetrics.METRIC_SOURCE.UNKNOWN } = {}
) {
+ aTab = gZenGlanceManager.getTabOrGlanceParent(gBrowser.selectedTab);
if (aTab.pinned || aTab == FirefoxViewHandler.tab) {
return;
@@ -1131,13 +1192,18 @@
}
this.showTab(aTab);
@@ -135,13 +129,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
aTab.setAttribute("pinned", "true");
this._updateTabBarForPinnedTabs();
@@ -1145,16 +1212,25 @@
}
unpinTab(aTab) {
+ aTab = gZenGlanceManager.getTabOrGlanceParent(gBrowser.selectedTab);
if (!aTab.pinned) {
return;
@@ -1150,11 +1216,19 @@
}
this.#handleTabMove(aTab, () => {
@@ -162,7 +150,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
});
aTab.style.marginInlineStart = "";
@@ -1369,6 +1445,9 @@
@@ -1369,6 +1443,9 @@
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
@@ -172,7 +160,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (
aIconURL &&
!LOCAL_PROTOCOLS.some(protocol => aIconURL.startsWith(protocol))
@@ -1378,6 +1457,9 @@
@@ -1378,6 +1455,9 @@
);
return;
}
@@ -182,7 +170,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let browser = this.getBrowserForTab(aTab);
browser.mIconURL = aIconURL;
@@ -1700,7 +1782,6 @@
@@ -1700,7 +1780,6 @@
// Preview mode should not reset the owner
if (!this._previewMode && !oldTab.selected) {
@@ -190,7 +178,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
let lastRelatedTab = this._lastRelatedTabMap.get(oldTab);
@@ -1791,6 +1872,7 @@
@@ -1791,6 +1870,7 @@
if (!this._previewMode) {
newTab.recordTimeFromUnloadToReload();
newTab.updateLastAccessed();
@@ -198,7 +186,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
oldTab.updateLastAccessed();
// if this is the foreground window, update the last-seen timestamps.
if (this.documentGlobal == BrowserWindowTracker.getTopWindow()) {
@@ -2005,6 +2087,9 @@
@@ -2005,6 +2085,9 @@
}
let activeEl = document.activeElement;
@@ -208,7 +196,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// If focus is on the old tab, move it to the new tab.
if (activeEl == oldTab) {
newTab.focus();
@@ -2043,7 +2128,7 @@
@@ -2043,7 +2126,7 @@
// Focus the location bar if it was previously focused for that tab.
// In full screen mode, only bother making the location bar visible
// if the tab is a blank one.
@@ -217,7 +205,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let selectURL = () => {
if (this._asyncTabSwitching) {
// Set _awaitingSetURI flag to suppress popup notification
@@ -2331,7 +2416,12 @@
@@ -2331,7 +2414,12 @@
return this._setTabLabel(aTab, aLabel);
}
@@ -231,7 +219,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (!aLabel || (isURL && /^about:reader\?url=/.test(aLabel))) {
return false;
}
@@ -2457,7 +2547,7 @@
@@ -2457,7 +2545,7 @@
newIndex = this.selectedTab._tPos + 1;
}
@@ -240,7 +228,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (this.isTabGroupLabel(targetTab)) {
throw new Error(
"Replacing a tab group label with a tab is not supported"
@@ -2737,6 +2827,7 @@
@@ -2737,6 +2825,7 @@
uriIsAboutBlank,
userContextId,
skipLoad,
@@ -248,7 +236,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} = {}) {
let b = document.createXULElement("browser");
// Use the JSM global to create the permanentKey, so that if the
@@ -2810,8 +2901,7 @@
@@ -2810,8 +2899,7 @@
// we use a different attribute name for this?
b.setAttribute("name", name);
}
@@ -258,7 +246,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
b.setAttribute("transparent", "true");
}
@@ -2981,7 +3071,7 @@
@@ -2981,7 +3069,7 @@
let panel = this.getPanel(browser);
let uniqueId = this._generateUniquePanelID();
@@ -267,7 +255,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary.
@@ -3041,8 +3131,8 @@
@@ -3041,8 +3129,8 @@
// If we transitioned from one browser to two browsers, we need to set
// hasSiblings=false on both the existing browser and the new browser.
if (this.tabs.length == 2) {
@@ -278,7 +266,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
}
@@ -3227,7 +3317,6 @@
@@ -3227,7 +3315,6 @@
this.selectedTab = this.addTrustedTab(BROWSER_NEW_TAB_URL, {
tabIndex: tab._tPos + 1,
userContextId: tab.userContextId,
@@ -286,7 +274,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
focusUrlBar: true,
});
resolve(this.selectedBrowser);
@@ -3337,6 +3426,10 @@
@@ -3337,6 +3424,10 @@
schemelessInput,
hasValidUserGestureActivation = false,
textDirectiveUserActivation = false,
@@ -297,22 +285,21 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} = {}
) {
// all callers of addTab that pass a params object need to pass
@@ -3347,10 +3440,25 @@
@@ -3347,10 +3438,24 @@
);
}
+ const beforeRouteResult = window.gZenSpaceRoutingManager.onBeforeAddTab(uriString, { skipRoute, pinned, tabGroup, fromExternal }, window);
+ const beforeRouteResult = window.gZenSpaceRoutingManager.onBeforeAddTab(uriString, { skipRoute, pinned, tabGroup, fromExternal, zenWorkspaceId }, window);
+ if (beforeRouteResult.shouldEarlyExit) {
+ return null;
+ }
+
+ let hasZenDefaultUserContextId = false;
+ let zenForcedWorkspaceId = undefined;
+ if (beforeRouteResult.isRouteFound && typeof userContextId !== "undefined") {
+ userContextId = beforeRouteResult.userContextId;
+ hasZenDefaultUserContextId = true;
+ } else if (typeof gZenWorkspaces !== "undefined" && !_forZenEmptyTab) {
+ [userContextId, hasZenDefaultUserContextId, zenForcedWorkspaceId] = gZenWorkspaces.getContextIdIfNeeded(userContextId, fromExternal, triggeringPrincipal);
+ [userContextId, hasZenDefaultUserContextId] = gZenWorkspaces.getContextIdIfNeeded(userContextId, fromExternal, triggeringPrincipal);
+ }
+
if (!UserInteraction.running("browser.tabs.opening", window)) {
@@ -323,7 +310,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// If we're opening a foreground tab, set the owner by default.
ownerTab ??= inBackground ? null : this.selectedTab;
@@ -3358,6 +3466,7 @@
@@ -3358,6 +3463,7 @@
if (this.selectedTab.owner) {
this.selectedTab.owner = null;
}
@@ -331,7 +318,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// Find the tab that opened this one, if any. This is used for
// determining positioning, and inherited attributes such as the
@@ -3410,6 +3519,22 @@
@@ -3410,6 +3516,18 @@
noInitialLabel,
skipBackgroundNotify,
});
@@ -340,10 +327,6 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
+ }
+ if (zenWorkspaceId) {
+ t.setAttribute("zen-workspace-id", zenWorkspaceId);
+ t.setAttribute("change-workspace", "")
+ } else if (zenForcedWorkspaceId !== undefined) {
+ t.setAttribute("zen-workspace-id", zenForcedWorkspaceId);
+ t.setAttribute("change-workspace", "")
+ }
+ if (_forZenEmptyTab) {
+ t.setAttribute("zen-empty-tab", "true");
@@ -354,7 +337,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (insertTab) {
// Insert the tab into the tab container in the correct position.
this.#insertTabAtIndex(t, {
@@ -3418,6 +3543,7 @@
@@ -3418,6 +3536,7 @@
ownerTab,
openerTab,
pinned,
@@ -362,7 +345,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
bulkOrderedOpen,
tabGroup: tabGroup ?? openerTab?.group,
});
@@ -3436,6 +3562,7 @@
@@ -3436,6 +3555,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@@ -370,7 +353,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}));
if (focusUrlBar) {
@@ -3560,6 +3687,12 @@
@@ -3560,6 +3680,12 @@
}
}
@@ -383,7 +366,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// Additionally send pinned tab events
if (pinned) {
this.#notifyPinnedStatus(t);
@@ -3570,6 +3703,15 @@
@@ -3570,6 +3696,15 @@
if (!inBackground) {
this.selectedTab = t;
}
@@ -399,7 +382,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
return t;
}
@@ -3802,6 +3944,7 @@
@@ -3802,6 +3937,7 @@
isAdoptingGroup = false,
isUserTriggered = false,
telemetryUserCreateSource = "unknown",
@@ -407,7 +390,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} = {}
) {
if (
@@ -3812,9 +3955,6 @@
@@ -3812,9 +3948,6 @@
!this.isSplitViewWrapper(tabOrSplitView)
)
) {
@@ -417,7 +400,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
if (!color) {
@@ -3835,9 +3975,14 @@
@@ -3835,9 +3968,14 @@
label,
isAdoptingGroup
);
@@ -434,7 +417,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
);
group.addTabs(tabsAndSplitViews);
@@ -3958,7 +4103,7 @@
@@ -3958,7 +4096,7 @@
}
this.#handleTabMove(tab, () =>
@@ -443,7 +426,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
);
}
@@ -4044,6 +4189,7 @@
@@ -4044,6 +4182,7 @@
color: group.color,
insertBefore: newTabs[0],
isAdoptingGroup: true,
@@ -451,7 +434,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
});
}
@@ -4254,6 +4400,7 @@
@@ -4254,6 +4393,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@@ -459,7 +442,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
) {
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
@@ -4323,6 +4470,7 @@
@@ -4323,6 +4463,7 @@
openWindowInfo,
name,
skipLoad,
@@ -467,7 +450,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
});
}
@@ -4536,9 +4684,9 @@
@@ -4536,9 +4677,9 @@
}
// Add a new tab if needed.
@@ -479,7 +462,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let url = "about:blank";
if (tabData.entries?.length) {
@@ -4575,8 +4723,10 @@
@@ -4575,8 +4716,10 @@
insertTab: false,
skipLoad: true,
preferredRemoteType,
@@ -491,7 +474,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (select) {
tabToSelect = tab;
}
@@ -4598,7 +4748,8 @@
@@ -4598,7 +4741,8 @@
this.pinTab(tab);
// Then ensure all the tab open/pinning information is sent.
this._fireTabOpen(tab, {});
@@ -501,7 +484,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let { groupId } = tabData;
const tabGroup = tabGroupWorkingData.get(groupId);
// if a tab refers to a tab group we don't know, skip any group
@@ -4618,7 +4769,10 @@
@@ -4618,7 +4762,10 @@
tabGroup.stateData.id,
tabGroup.stateData.color,
tabGroup.stateData.collapsed,
@@ -513,7 +496,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
);
tabsFragment.appendChild(tabGroup.node);
}
@@ -4673,9 +4827,21 @@
@@ -4673,9 +4820,21 @@
// to remove the old selected tab.
if (tabToSelect) {
let leftoverTab = this.selectedTab;
@@ -535,15 +518,12 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (tabs.length > 1 || !tabs[0].selected) {
this._updateTabsAfterInsert();
@@ -4866,11 +5032,17 @@
@@ -4866,11 +5025,14 @@
if (ownerTab) {
tab.owner = ownerTab;
}
+ if ((!tab.pinned && tabGroup?.isZenFolder && !Services.prefs.getBoolPref('zen.folders.owned-tabs-in-folder')) || (tabGroup && tabGroup.hasAttribute("split-view-group"))) {
+ tabGroup = null;
+ }
+ if (openerTab?.hasAttribute("zen-glance-tab")) {
+ openerTab = gZenGlanceManager.getTabOrGlanceParent(openerTab);
+ }
// Ensure we have an index if one was not provided.
@@ -554,7 +534,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -4882,7 +5054,7 @@
@@ -4882,7 +5044,7 @@
let lastRelatedTab =
openerTab && this._lastRelatedTabMap.get(openerTab);
let previousTab = lastRelatedTab || openerTab || this.selectedTab;
@@ -563,7 +543,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
tabGroup = previousTab.group;
}
if (
@@ -4898,7 +5070,7 @@
@@ -4898,7 +5060,7 @@
previousTab.splitview
) + 1;
} else if (previousTab.visible) {
@@ -572,7 +552,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} else if (previousTab == FirefoxViewHandler.tab) {
elementIndex = 0;
}
@@ -4926,14 +5098,14 @@
@@ -4926,14 +5088,14 @@
}
// Ensure index is within bounds.
if (tab.pinned) {
@@ -591,7 +571,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (pinned && !itemAfter?.pinned) {
itemAfter = null;
@@ -4950,7 +5122,7 @@
@@ -4950,7 +5112,7 @@
this.tabContainer._invalidateCachedTabs();
@@ -600,7 +580,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (
(this.isTab(itemAfter) && itemAfter.group == tabGroup) ||
this.isSplitViewWrapper(itemAfter)
@@ -4981,7 +5153,11 @@
@@ -4981,7 +5143,11 @@
const tabContainer = pinned
? this.tabContainer.pinnedTabsContainer
: this.tabContainer;
@@ -612,7 +592,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
if (tab.group?.collapsed) {
@@ -4996,6 +5172,7 @@
@@ -4996,6 +5162,7 @@
if (pinned) {
this._updateTabBarForPinnedTabs();
}
@@ -620,7 +600,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
TabBarVisibility.update();
}
@@ -5544,6 +5721,7 @@
@@ -5544,6 +5711,7 @@
telemetrySource,
} = {}
) {
@@ -628,7 +608,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window.
if (
@@ -5633,6 +5811,7 @@
@@ -5633,6 +5801,7 @@
if (lastToClose) {
this.removeTab(lastToClose, aParams);
}
@@ -636,7 +616,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} catch (e) {
console.error(e);
}
@@ -5678,6 +5857,14 @@
@@ -5678,6 +5847,14 @@
return;
}
@@ -651,7 +631,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let isVisibleTab = aTab.visible;
// We have to sample the tab width now, since _beginRemoveTab might
// end up modifying the DOM in such a way that aTab gets a new
@@ -5685,6 +5872,9 @@
@@ -5685,6 +5862,9 @@
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
let isLastTab = this.#isLastTabInWindow(aTab);
@@ -661,7 +641,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -5696,13 +5886,14 @@
@@ -5696,13 +5876,14 @@
telemetrySource,
})
) {
@@ -677,7 +657,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let lockTabSizing =
!this.tabContainer.verticalMode &&
!aTab.pinned &&
@@ -5733,7 +5924,13 @@
@@ -5733,7 +5914,13 @@
// We're not animating, so we can cancel the animation stopwatch.
Glean.browserTabclose.timeAnim.cancel(aTab._closeTimeAnimTimerId);
aTab._closeTimeAnimTimerId = null;
@@ -692,7 +672,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
return;
}
@@ -5867,7 +6064,7 @@
@@ -5867,7 +6054,7 @@
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
@@ -701,7 +681,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -5891,6 +6088,7 @@
@@ -5891,6 +6078,7 @@
newTab = true;
}
@@ -709,7 +689,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -5931,13 +6129,7 @@
@@ -5931,13 +6119,7 @@
aTab._mouseleave();
if (newTab) {
@@ -724,7 +704,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} else {
TabBarVisibility.update();
}
@@ -6070,6 +6262,7 @@
@@ -6070,6 +6252,7 @@
this.tabs[i]._tPos = i;
}
@@ -732,7 +712,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (!this._windowIsClosing) {
// update tab close buttons state
this.tabContainer._updateCloseButtons();
@@ -6255,6 +6448,7 @@
@@ -6255,6 +6438,7 @@
memory_after: await getTotalMemoryUsage(),
time_to_unload_in_ms: timeElapsed,
});
@@ -740,7 +720,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
/**
@@ -6300,6 +6494,7 @@
@@ -6300,6 +6484,7 @@
}
let excludeTabs = new Set(aExcludeTabs);
@@ -748,7 +728,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -6312,15 +6507,22 @@
@@ -6312,15 +6497,22 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@@ -773,7 +753,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let tab = this.tabContainer.findNextTab(aTab, {
direction: 1,
filter: _tab => remainingTabs.includes(_tab),
@@ -6334,7 +6536,7 @@
@@ -6334,7 +6526,7 @@
}
if (tab) {
@@ -782,7 +762,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -6355,7 +6557,7 @@
@@ -6355,7 +6547,7 @@
});
}
@@ -791,7 +771,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
_blurTab(aTab) {
@@ -6366,7 +6568,7 @@
@@ -6366,7 +6558,7 @@
* @returns {boolean}
* False if swapping isn't permitted, true otherwise.
*/
@@ -800,7 +780,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// Do not allow transfering a private tab to a non-private window
// and vice versa.
if (
@@ -6420,6 +6622,7 @@
@@ -6420,6 +6612,7 @@
// fire the beforeunload event in the process. Close the other
// window if this was its last tab.
if (
@@ -808,7 +788,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
!remoteBrowser._beginRemoveTab(aOtherTab, {
adoptedByTab: aOurTab,
closeWindowWithLastTab: true,
@@ -6431,7 +6634,7 @@
@@ -6431,7 +6624,7 @@
// If this is the last tab of the window, hide the window
// immediately without animation before the docshell swap, to avoid
// about:blank being painted.
@@ -817,7 +797,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (closeWindow) {
let win = aOtherTab.documentGlobal;
win.windowUtils.suppressAnimation(true);
@@ -6565,11 +6768,13 @@
@@ -6565,11 +6758,13 @@
}
// Finish tearing down the tab that's going away.
@@ -831,7 +811,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
this.setTabTitle(aOurTab);
@@ -6771,10 +6976,10 @@
@@ -6771,10 +6966,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@@ -844,7 +824,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -6834,7 +7039,8 @@
@@ -6834,7 +7029,8 @@
* @param {object} [aOptions={}]
* Key-value pairs that will be serialized into the features string.
*/
@@ -854,7 +834,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (this.tabs.length == 1) {
return null;
}
@@ -6851,7 +7057,7 @@
@@ -6851,7 +7047,7 @@
// tell a new window to take the "dropped" tab
let args = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
args.appendElement(aTab.splitview ?? aTab);
@@ -863,7 +843,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
private: PrivateBrowsingUtils.isWindowPrivate(window),
features: Object.entries(aOptions)
.map(([key, value]) => `${key}=${value}`)
@@ -6859,6 +7065,8 @@
@@ -6859,6 +7055,8 @@
openerWindow: window,
args,
});
@@ -872,7 +852,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
/**
@@ -6971,7 +7179,7 @@
@@ -6971,7 +7169,7 @@
* `true` if element is a `<tab-group>`
*/
isTabGroup(element) {
@@ -881,7 +861,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
/**
@@ -7056,8 +7264,8 @@
@@ -7056,8 +7254,8 @@
}
// Don't allow mixing pinned and unpinned tabs.
@@ -892,7 +872,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -7103,8 +7311,8 @@
@@ -7103,8 +7301,8 @@
this.#handleTabMove(
element,
() => {
@@ -903,7 +883,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
neighbor = neighbor.group;
}
if (neighbor?.splitview) {
@@ -7115,6 +7323,12 @@
@@ -7115,6 +7313,12 @@
return;
}
}
@@ -916,7 +896,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
if (movingForwards && neighbor) {
neighbor.after(element);
@@ -7173,23 +7387,31 @@
@@ -7173,23 +7377,31 @@
#moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) {
if (this.isTabGroupLabel(targetElement)) {
targetElement = targetElement.group;
@@ -954,7 +934,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
} else if (!element.pinned && targetElement && targetElement.pinned) {
// If the caller asks to move an unpinned element next to a pinned
// tab, move the unpinned element to be the first unpinned element
@@ -7202,12 +7424,35 @@
@@ -7202,12 +7414,35 @@
// move the tab group right before the first unpinned tab.
// 4. Moving a tab group and the first unpinned tab is grouped:
// move the tab group right before the first unpinned tab's tab group.
@@ -991,7 +971,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// We want to include the splitview wrapper if it's the targetElement, but
// not in the case where we want to reverse tabs within the same splitview.
@@ -7216,6 +7461,7 @@
@@ -7216,6 +7451,7 @@
}
let getContainer = () =>
@@ -999,7 +979,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
element.pinned
? this.tabContainer.pinnedTabsContainer
: this.tabContainer;
@@ -7224,11 +7470,15 @@
@@ -7224,11 +7460,15 @@
element,
() => {
if (moveBefore) {
@@ -1016,7 +996,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
},
metricsContext
@@ -7302,11 +7552,15 @@
@@ -7302,11 +7542,15 @@
* @param {TabMetricsContext} [metricsContext]
*/
moveTabToExistingGroup(aTab, aGroup, metricsContext) {
@@ -1035,7 +1015,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
if (aTab.group && aTab.group.id === aGroup.id) {
return;
@@ -7378,6 +7632,7 @@
@@ -7378,6 +7622,7 @@
let state = {
tabIndex: tab._tPos,
@@ -1043,7 +1023,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
};
if (tab.visible) {
state.elementIndex = tab.elementIndex;
@@ -7409,7 +7664,7 @@
@@ -7409,7 +7654,7 @@
let changedSplitView =
previousTabState.splitViewId != currentTabState.splitViewId;
@@ -1052,7 +1032,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
tab.dispatchEvent(
new CustomEvent("TabMove", {
bubbles: true,
@@ -7456,6 +7711,10 @@
@@ -7456,6 +7701,10 @@
moveActionCallback();
@@ -1063,7 +1043,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -7506,7 +7765,22 @@
@@ -7506,7 +7755,22 @@
* @returns {object}
* The new tab in the current window, null if the tab couldn't be adopted.
*/
@@ -1087,7 +1067,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
// Swap the dropped tab with a new one we create and then close
// it in the other window (making it seem to have moved between
// windows). We also ensure that the tab we create to swap into has
@@ -7549,6 +7823,8 @@
@@ -7549,6 +7813,8 @@
}
params.skipLoad = true;
let newTab = this.addWebTab("about:blank", params);
@@ -1096,7 +1076,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
aTab.container.tabDragAndDrop.finishAnimateTabMove();
@@ -8259,7 +8535,7 @@
@@ -8259,7 +8525,7 @@
// preventDefault(). It will still raise the window if appropriate.
return;
}
@@ -1105,7 +1085,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
window.focus();
aEvent.preventDefault();
}
@@ -8276,7 +8552,6 @@
@@ -8276,7 +8542,6 @@
on_TabGroupCollapse(aEvent) {
aEvent.target.tabs.forEach(tab => {
@@ -1113,7 +1093,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
});
}
@@ -8630,7 +8905,9 @@
@@ -8630,7 +8895,9 @@
let filter = this._tabFilters.get(tab);
if (filter) {
@@ -1123,7 +1103,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
let listener = this._tabListeners.get(tab);
if (listener) {
@@ -9435,6 +9712,7 @@
@@ -9435,6 +9702,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@@ -1131,7 +1111,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -9515,6 +9793,7 @@
@@ -9515,6 +9783,7 @@
// known defaults. Note we use the original URL since about:newtab
// redirects to a prerendered page.
const shouldRemoveFavicon =
@@ -1139,7 +1119,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
!this.mBrowser.mIconURL &&
!ignoreBlank &&
!(originalLocation.spec in FAVICON_DEFAULTS);
@@ -9689,13 +9968,6 @@
@@ -9689,13 +9958,6 @@
this.mBrowser.originalURI = aRequest.originalURI;
}
@@ -1153,7 +1133,7 @@ index 08b5b56e069d038d72c87355920c4ce8a55ed805..7349b78214fe23700c6496293ac03cdb
}
let userContextId = this.mBrowser.getAttribute("usercontextid") || 0;
@@ -10587,7 +10859,8 @@ var TabContextMenu = {
@@ -10587,7 +10849,8 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;

View File

@@ -1,9 +1,9 @@
diff --git a/browser/components/urlbar/UrlbarUtils.sys.mjs b/browser/components/urlbar/UrlbarUtils.sys.mjs
index aa7c67f2bfaa3f15d592a14b527a8721dfc9bc6f..d2fe012796ea3a5be05090a732011b3cf92b78be 100644
index 2f03bdf632c6ca15c728df2801162da5159682da..6834daede8cb11854f137602100183d85a930686 100644
--- a/browser/components/urlbar/UrlbarUtils.sys.mjs
+++ b/browser/components/urlbar/UrlbarUtils.sys.mjs
@@ -110,6 +110,8 @@ export var UrlbarUtils = {
SEMANTIC_HISTORY: "semanticHistory",
@@ -109,6 +109,8 @@ export var UrlbarUtils = {
RESTRICT_SEARCH_KEYWORD: "restrictSearchKeyword",
SUGGESTED_INDEX: "suggestedIndex",
TAIL_SUGGESTION: "tailSuggestion",
+ ZEN_ACTION: "zenAction",
@@ -11,7 +11,7 @@ index aa7c67f2bfaa3f15d592a14b527a8721dfc9bc6f..d2fe012796ea3a5be05090a732011b3c
}),
// Defines provider types.
@@ -171,6 +173,8 @@ export var UrlbarUtils = {
@@ -170,6 +172,8 @@ export var UrlbarUtils = {
OTHER_NETWORK: 6,
ADDON: 7,
ACTIONS: 8,
@@ -20,7 +20,7 @@ index aa7c67f2bfaa3f15d592a14b527a8721dfc9bc6f..d2fe012796ea3a5be05090a732011b3c
}),
// Per-result exposure telemetry.
@@ -320,6 +324,14 @@ export var UrlbarUtils = {
@@ -319,6 +323,14 @@ export var UrlbarUtils = {
telemetryLabel: "actions",
uiLabel: "urlbar-searchmode-actions2",
},
@@ -35,7 +35,7 @@ index aa7c67f2bfaa3f15d592a14b527a8721dfc9bc6f..d2fe012796ea3a5be05090a732011b3c
]);
},
@@ -612,6 +624,12 @@ export var UrlbarUtils = {
@@ -611,6 +623,12 @@ export var UrlbarUtils = {
return this.RESULT_GROUP.HEURISTIC_FALLBACK;
case "UrlbarProviderHistoryUrlHeuristic":
return this.RESULT_GROUP.HEURISTIC_HISTORY_URL;

View File

@@ -486,6 +486,8 @@ groupbox h2 {
#tabGroupSuggestions,
#web-appearance-manage-themes-link,
#setting-control-sidebarChatbotFieldset,
#aiControlsDescription,
#category-ai-features,
#setting-control-supportFirefox,
.mission-message,
html|setting-group:is([data-subcategory="layout"], [groupid="support"]) {

View File

@@ -16,4 +16,3 @@ category app-startup nsBrowserGlue @mozilla.org/browser/browserglue;1 applicatio
#include common/Components.manifest
#include sessionstore/SessionComponents.manifest
#include live-folders/LiveFoldersComponents.manifest
#include space-routing/SpaceRoutingComponents.manifest

View File

@@ -1579,7 +1579,6 @@ window.gZenVerticalTabsManager = {
overflowElements.appendChild(child);
} else {
const element = document.getElementById("page-action-buttons");
child.setAttribute("context", "toolbar-context-menu");
element.before(child);
}
return;
@@ -1613,9 +1612,7 @@ window.gZenVerticalTabsManager = {
// it will reset to the original name anyway
if (hasChanged || (this._tabEdited.zenStaticLabel && newName)) {
this._tabEdited.zenStaticLabel = newName;
gBrowser._setTabLabel(this._tabEdited, newName, {
_zenChangeLabelFlag: true,
});
gBrowser._setTabLabel(this._tabEdited, newName);
gZenUIManager.showToast("zen-tabs-renamed");
} else {
delete this._tabEdited.zenStaticLabel;
@@ -1711,8 +1708,7 @@ window.gZenVerticalTabsManager = {
this._tabEdited.after(input);
}
input.focus();
input.setSelectionRange(0, input.value.length, "backward");
input.scrollLeft = 0;
input.select();
input.addEventListener("blur", this._renameTabHalt);
},

View File

@@ -35,6 +35,13 @@ export class ZenSpaceRoutingNavigation extends ZenUIComponent {
return;
}
// The tab we spawn for a route must be allowed to load once without being
// redirected again, regardless of when its workspace attribute lands.
if (aBrowser._zenSkipNavRouteOnce) {
aBrowser._zenSkipNavRouteOnce = false;
return;
}
let uri;
try {
uri = aRequest.QueryInterface(Ci.nsIChannel).URI;
@@ -73,49 +80,16 @@ export class ZenSpaceRoutingNavigation extends ZenUIComponent {
}
const currentWorkspaceId = tab.getAttribute("zen-workspace-id");
const targetWorkspaceId =
win.gZenSpaceRoutingManager.getRedirectTargetWorkspaceId(
if (
!win.gZenSpaceRoutingManager.shouldRedirectNavigation(
uri.spec,
currentWorkspaceId,
win
);
if (!targetWorkspaceId) {
)
) {
return;
}
// A brand-new tab whose very first real navigation this is (a
// target="_blank" link, window.open(), or a freshly opened tab) is still
// showing its initial about:blank document. There is nothing to preserve,
// so rather than cancelling the load and spawning a duplicate tab - which
// would leave this one behind empty - just move this very tab into the
// destination space and let the in-flight load finish in place.
const isInitialDocument =
aBrowser.browsingContext?.currentWindowGlobal?.isInitialDocument ?? false;
if (isInitialDocument) {
const wasSelected = tab.selected;
// Defer so we don't mutate the tab strip from inside a progress notification.
win.setTimeout(() => {
if (!tab.isConnected) {
return;
}
gBrowser.selectedTab = tab.owner;
win.gZenWorkspaces.moveTabToWorkspace(tab, targetWorkspaceId);
if (wasSelected) {
const targetWorkspace =
win.gZenWorkspaces.getWorkspaceFromId(targetWorkspaceId);
if (targetWorkspace) {
win.gZenWorkspaces.lastSelectedWorkspaceTabs[targetWorkspaceId] =
tab;
win.gZenWorkspaces.changeWorkspace(targetWorkspace);
}
}
}, 0);
return;
}
// An already-loaded page is navigating in place. Preserve it in its current
// tab and re-open the destination in a new routed tab instead.
//
// Under Fission the parent-side aRequest is a RemoteWebProgress stand-in
// whose cancel()/loadInfo throw NS_ERROR_NOT_IMPLEMENTED (the real channel
// lives in the content process). Stop the in-place load through the browser,
@@ -137,14 +111,13 @@ export class ZenSpaceRoutingNavigation extends ZenUIComponent {
// Defer so we don't mutate the tab strip from inside a progress notification.
win.setTimeout(() => {
gBrowser.addTab(urlToOpen, {
const newTab = gBrowser.addTab(urlToOpen, {
triggeringPrincipal: principal,
ownerTab: tab.isConnected ? tab : null,
// The user was actively navigating this tab, so follow the navigation
// into the routed tab instead of opening it in the background (addTab
// defaults inBackground to true).
inBackground: false,
});
if (newTab?.linkedBrowser) {
newTab.linkedBrowser._zenSkipNavRouteOnce = true;
}
}, 0);
}
}

View File

@@ -78,9 +78,6 @@ document.addEventListener(
case "cmd_zenReplacePinnedUrlWithCurrent":
gZenPinnedTabManager.replacePinnedUrlWithCurrent();
break;
case "cmd_zenEditPinnedUrl":
gZenPinnedTabManager.editPinnedUrl();
break;
case "cmd_contextZenAddToEssentials":
gZenPinnedTabManager.addToEssentials();
break;
@@ -115,9 +112,7 @@ document.addEventListener(
});
break;
case "cmd_zenTogglePinTab": {
const currentTab = gZenGlanceManager.getTabOrGlanceParent(
gBrowser.selectedTab
);
const currentTab = gBrowser.selectedTab;
if (currentTab && !currentTab.hasAttribute("zen-empty-tab")) {
if (currentTab.pinned) {
gBrowser.unpinTab(currentTab);

View File

@@ -51,10 +51,6 @@
--zen-toolbox-max-width: 74px !important;
--zen-compact-float: var(--zen-element-separation);
@media (-moz-mac-tahoe-theme) {
--zen-compact-mode-no-padding-radius-fix: -2px;
}
:root[zen-no-padding='true'] & {
--zen-compact-float: 10px;
--zen-compact-top-toolbar-hidden-fix: var(--zen-compact-float);

View File

@@ -85,7 +85,8 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
menuitem.addEventListener("command", () =>
this.openGlance({
url: gContextMenu.linkURL,
triggeringPrincipal: gContextMenu.principal,
triggeringPrincipal:
Services.scriptSecurityManager.getSystemPrincipal(),
})
);
@@ -353,28 +354,6 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
return this.#lastLinkClickData;
}
/**
* Check whether a glance load is permitted for its triggering principal.
*
* @param {object} data - Glance data including URL and triggeringPrincipal
* @returns {boolean} Whether the load is allowed
*/
#isGlanceLoadAllowed(data) {
const { url, triggeringPrincipal } = data ?? {};
if (typeof url !== "string" || !url.length || !triggeringPrincipal) {
return false;
}
try {
Services.scriptSecurityManager.checkLoadURIStrWithPrincipal(
triggeringPrincipal,
url
);
} catch {
return false;
}
return true;
}
/**
* Open a glance overlay with the specified data
*
@@ -392,13 +371,6 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
return Promise.resolve(this.#currentTab);
}
// Existing-tab glances perform no navigation and are exempt; for fresh
// loads, refuse any URL the triggering principal isn't allowed to load
// (e.g. a web page linking to file://).
if (!existingTab && !this.#isGlanceLoadAllowed(data)) {
return Promise.resolve(null);
}
if (!data.height || !data.width) {
data = {
...data,

View File

@@ -1232,38 +1232,19 @@ class nsZenWindowSync {
activeIndex = Math.min(activeIndex, entries.length - 1);
activeIndex = Math.max(activeIndex, 0);
let entryToUse = (entries[activeIndex] || entries[0]) ?? null;
this.#setPinnedInitialState(
aTab,
{ url: entryToUse?.url, title: entryToUse?.title },
image
);
});
}
/**
* Sets the canonical pinned URL for a tab across all windows. Used to let the
* user edit a pinned tab's URL directly.
*
* @param {object} aTab - The tab to set the pinned URL for.
* @param {string} aUrl - The URL to store as the canonical pinned URL.
* @param {string} [aImage] - Optional Icon to store.
*/
setPinnedUrl(aTab, aUrl, aImage) {
this.log(`Setting pinned url for tab ${aTab.id}`);
this.#setPinnedInitialState(
aTab,
{ url: aUrl, title: aTab.zenStaticLabel },
aImage
);
}
#setPinnedInitialState(aTab, aEntry, aImage) {
const initialState = { entry: aEntry, image: aImage };
this.#runOnAllWindows(null, win => {
const targetTab = this.getItemFromWindow(win, aTab.id);
if (targetTab) {
targetTab._zenPinnedInitialState = initialState;
}
const initialState = {
entry: {
url: entryToUse?.url,
title: entryToUse?.title,
},
image,
};
this.#runOnAllWindows(null, win => {
const targetTab = this.getItemFromWindow(win, aTab.id);
if (targetTab) {
targetTab._zenPinnedInitialState = initialState;
}
});
});
}

View File

@@ -1,5 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
category browser-window-delayed-startup resource:///modules/zen/spacerouting/ZenSpaceRoutingManager.sys.mjs gZenSpaceRoutingManager.onDelayedBrowserStartup

View File

@@ -3,6 +3,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { JSONFile } from "resource://gre/modules/JSONFile.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"shouldForceContainerTabsToWorkspace",
"zen.workspaces.force-container-workspace",
false
);
class nsZenSpaceRoutingManager {
#file = null;
@@ -18,58 +28,6 @@ class nsZenSpaceRoutingManager {
this.#readFromDisk();
}
/**
* Auto invoked for every window on delayed startup
*
* @param {nsIDOMWindow} window - The browser window that just started up
*/
onDelayedBrowserStartup(window) {
const element = window.MozXULElement.parseXULToFragment(`
<menuseparator/>
<menuitem id="context_zen-add-domain-to-routing"
data-lazy-l10n-id="tab-context-zen-add-domain-to-sr"
data-l10n-args='{"tabCount": 1}'/>
`);
window.document.getElementById("context_undoCloseTab").after(element);
window.document
.getElementById("context_zen-add-domain-to-routing")
.addEventListener("command", this.#onAddSelectedToRouting.bind(this));
window.document
.getElementById("tabContextMenu")
.addEventListener(
"popupshowing",
this.#updateTabCloseCountState.bind(this)
);
}
/**
* Updates the "context_zen-add-domain-to-routing" command
* to reflect the number of selected tabs, when applicable.
*
* @param {Event} event - The event param
*/
#updateTabCloseCountState(event) {
const window = event.target.documentGlobal;
window.document.l10n.setArgs(
window.document.getElementById("context_zen-add-domain-to-routing"),
{ tabCount: window.gBrowser.selectedTabs.length }
);
}
/**
* Callback for whenever the menuitem command is ran
*
* @param {Event} event - The event parameter
*/
#onAddSelectedToRouting(event) {
const window = event.target.documentGlobal;
const tabs = window.TabContextMenu.contextTab.multiselected
? window.gBrowser.selectedTabs
: [window.TabContextMenu.contextTab];
this.addRouteForSelected(tabs, window);
}
/**
* Callback that will be executed from tabbrowser.js
* This method can be used to stop the tab from being created.
@@ -104,7 +62,7 @@ class nsZenSpaceRoutingManager {
break;
default: {
const targetWorkspace =
win.gZenWorkspaces.getWorkspaceFromId(targetRoute);
win?.gZenWorkspaces?.getWorkspaceFromId(targetRoute);
if (targetWorkspace) {
userContextId = targetWorkspace.containerTabId;
@@ -114,6 +72,37 @@ class nsZenSpaceRoutingManager {
}
}
if (!isRouteFound) {
let tabSpaceId = options.zenWorkspaceId;
let spaceManager = win.gZenWorkspaces;
if (lazy.shouldForceContainerTabsToWorkspace) {
// In case its undefined, to make it into an integer.
const tabContainerId = options.userContextId || 0;
const currentSpace = spaceManager.getActiveWorkspaceFromCache();
console.log("[ZenSpaceRouting] Tab is opening with userContextId", tabContainerId, "and active space has containerTabId", currentSpace.containerTabId);
if (tabContainerId !== currentSpace.containerTabId) {
const targetWorkspace = spaceManager.getWorkspaces().find(
workspace => workspace.containerTabId === tabContainerId
);
if (targetWorkspace) {
tabSpaceId = targetWorkspace.uuid;
}
}
}
// Add support for zen.workspaces.force-container-workspace in SR,
// instead of using the old implementation. Lets create a temporary route
// for this tab, so that it will be routed to the correct space.
if (tabSpaceId && tabSpaceId !== spaceManager.activeWorkspace) {
const targetWorkspace = spaceManager.getWorkspaceFromId(tabSpaceId);
if (targetWorkspace) {
userContextId = targetWorkspace.containerTabId;
isRouteFound = true;
targetWorkspaceName = targetWorkspace.name;
targetRoute = tabSpaceId;
}
}
}
return {
shouldEarlyExit: false,
userContextId,
@@ -159,26 +148,8 @@ class nsZenSpaceRoutingManager {
* @returns {boolean} True when the navigation should open in a new routed tab
*/
shouldRedirectNavigation(uriString, currentWorkspaceId, win) {
return !!this.getRedirectTargetWorkspaceId(
uriString,
currentWorkspaceId,
win
);
}
/**
* Resolves the destination space for an in-place top-level navigation, or
* null when the navigation should be left alone (no rule, the destination is
* "most-recent-space", the tab already lives there, or the space is gone).
*
* @param {string} uriString - The destination URI
* @param {string|null} currentWorkspaceId - The zen-workspace-id of the navigating tab
* @param {Window} win - The owning browser window
* @returns {string|null} The target workspace id, or null to leave the navigation in place
*/
getRedirectTargetWorkspaceId(uriString, currentWorkspaceId, win) {
if (!win?.gZenWorkspaces?.workspaceEnabled) {
return null;
return false;
}
const targetRoute = this.routeUri(uriString, { fromExternal: false });
@@ -188,13 +159,11 @@ class nsZenSpaceRoutingManager {
targetRoute === "most-recent-space" ||
targetRoute === currentWorkspaceId
) {
return null;
return false;
}
// Only redirect when the destination space actually exists.
return win.gZenWorkspaces.getWorkspaceFromId(targetRoute)
? targetRoute
: null;
return !!win.gZenWorkspaces.getWorkspaceFromId(targetRoute);
}
/**
@@ -239,12 +208,16 @@ class nsZenSpaceRoutingManager {
break;
default: {
const workspaces = win?.gZenWorkspaces;
const targetWorkspace = workspaces?.getWorkspaceFromId?.(targetRoute);
const workspaces = win.gZenWorkspaces;
const targetWorkspace = workspaces.getWorkspaceFromId(targetRoute);
if (targetWorkspace) {
workspaces.moveTabToWorkspace(newTab, targetWorkspace.uuid);
if (inBackground) {
return;
}
const mostRecentWindow =
Services.wm.getMostRecentWindow("navigator:browser");
const isOriginatingWindow = win === mostRecentWindow;
@@ -252,10 +225,7 @@ class nsZenSpaceRoutingManager {
win.gZenWorkspaces.lastSelectedWorkspaceTabs[
targetWorkspace.uuid
] = newTab;
if (!inBackground) {
await win.gZenWorkspaces.changeWorkspace(targetWorkspace);
}
await win.gZenWorkspaces.changeWorkspace(targetWorkspace);
}
}
}
@@ -474,37 +444,6 @@ class nsZenSpaceRoutingManager {
this.#file.data.defaultRouteExternal = routeType;
}
/**
* Adds a new route for all given tabs
*
* @param {Array<object>} selectedTabs - The tabs that should be routed
* @param {Window} parentWindow - The window from which this is being executed
*/
addRouteForSelected(selectedTabs, parentWindow) {
const newRoute = this.createNewRoute();
let routeReference = "";
if (selectedTabs.length == 1) {
newRoute.matchType = "contains";
routeReference = selectedTabs[0].linkedBrowser.currentURI.host;
} else {
newRoute.matchType = "regex";
routeReference = "(";
for (let i = 0; i < selectedTabs.length; i++) {
const domain = selectedTabs[i].linkedBrowser.currentURI.host;
routeReference += domain.replaceAll(".", "\.");
if (i != selectedTabs.length - 1) {
routeReference += "|";
}
}
routeReference += ")";
}
newRoute.reference = routeReference;
this.updateRoute(newRoute);
this.openSpaceRoutingDialog(parentWindow);
}
/**
* Saves all routes. The list of
* routes is stripped of empty routes

View File

@@ -182,8 +182,8 @@ class nsZenWorkspaceCreation extends MozXULElement {
this.onProfileCommand.bind(this)
);
this.profilesPopup.addEventListener(
"popupshowing",
this.onProfilePopupShowing.bind(this)
"popupshown",
this.onProfilePopupShown.bind(this)
);
this.profilesPopup.addEventListener(
"command",
@@ -296,7 +296,7 @@ class nsZenWorkspaceCreation extends MozXULElement {
this.profilesPopup.openPopup(event.target, "after_start");
}
onProfilePopupShowing(event) {
onProfilePopupShown(event) {
return window.createUserContextMenu(event, {
isContextMenu: true,
showDefaultTab: true,

View File

@@ -106,12 +106,6 @@ class nsZenWorkspaces {
"zen.workspaces.wrap-around-navigation",
true
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"shouldForceContainerTabsToWorkspace",
"zen.workspaces.force-container-workspace",
true
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"shouldOpenNewTabIfLastUnpinnedTabIsClosed",
@@ -788,11 +782,6 @@ class nsZenWorkspaces {
window.addEventListener("TabUnpinned", tabUpdateListener);
window.addEventListener("aftercustomization", tabUpdateListener);
window.addEventListener("TabSelect", this.onLocationChange.bind(this));
window.addEventListener(
"TabBrowserInserted",
this.onTabBrowserInserted.bind(this)
);
this.updateWorkspacesChangeContextMenu();
})();
}
@@ -1506,15 +1495,15 @@ class nsZenWorkspaces {
continue;
}
if (container) {
const newtabPlacement = Services.prefs.getBoolPref(
"zen.view.show-newtab-button-top",
false
);
const insertElement = newtabPlacement
? container.firstChild
: container.lastChild;
const newtabPlacement = Services.prefs.getBoolPref(
"zen.view.show-newtab-button-top",
false
);
const insertElement = newtabPlacement
? container.firstChild
: container.lastChild;
if (container) {
if (tab.group?.hasAttribute("split-view-group")) {
gBrowser.zenHandleTabMove(tab.group, () => {
for (const subTab of tab.group.tabs) {
@@ -2298,12 +2287,12 @@ class nsZenWorkspaces {
}
onBeforeTabSelect(aTab) {
if (this.#inChangingWorkspace || !aTab) {
if (this.#inChangingWorkspace) {
// Just in case, Let's not do these checks while we are
// in the middle of changing workspace,
return false;
}
const tabSpace = aTab.getAttribute("zen-workspace-id");
const tabSpace = aTab?.getAttribute("zen-workspace-id");
if (
tabSpace &&
tabSpace !== this.activeWorkspace &&
@@ -2794,44 +2783,6 @@ class nsZenWorkspaces {
}
}
async onTabBrowserInserted(event) {
let tab = event.originalTarget;
const isEssential = tab.getAttribute("zen-essential") === "true";
const workspaceID = tab.getAttribute("zen-workspace-id");
if (!this.workspaceEnabled || isEssential) {
return;
}
if (workspaceID) {
if (
tab.hasAttribute("change-workspace") &&
this.moveTabToWorkspace(tab, workspaceID)
) {
this.lastSelectedWorkspaceTabs[workspaceID] =
gZenGlanceManager.getTabOrGlanceParent(tab);
tab.removeAttribute("change-workspace");
const workspace = this.getWorkspaceFromId(workspaceID);
setTimeout(() => {
this.changeWorkspace(workspace);
}, 0);
}
return;
}
let activeWorkspace = this.getActiveWorkspace();
if (!activeWorkspace) {
return;
}
if (tab.hasAttribute("zen-workspace-id")) {
const tabWorkspaceId = tab.getAttribute("zen-workspace-id");
this.moveTabToWorkspace(tab, tabWorkspaceId);
await this.changeWorkspaceWithID(tabWorkspaceId);
} else {
tab.setAttribute("zen-workspace-id", activeWorkspace.uuid);
}
}
#changeToEmptyTab() {
const isEmpty = gBrowser.selectedTab.hasAttribute("zen-empty-tab");
gZenCompactModeManager.sidebar.toggleAttribute(
@@ -3017,7 +2968,7 @@ class nsZenWorkspaces {
getContextIdIfNeeded(userContextId, fromExternal, triggeringPrincipal) {
if (!this.workspaceEnabled) {
return [userContextId, false, undefined];
return [userContextId, false];
}
if (
@@ -3025,27 +2976,7 @@ class nsZenWorkspaces {
triggeringPrincipal.isAddonOrExpandedAddonPrincipal &&
typeof userContextId === "undefined"
) {
return [userContextId, false, undefined];
}
if (
this.shouldForceContainerTabsToWorkspace &&
typeof userContextId !== "undefined" &&
this._workspaceCache &&
!fromExternal
) {
// Find all workspaces that match the given userContextId
const matchingWorkspaces = this._workspaceCache.filter(
workspace => workspace.containerTabId === userContextId
);
// Check if exactly one workspace matches
if (matchingWorkspaces.length === 1) {
const workspace = matchingWorkspaces[0];
if (workspace.uuid !== this.getActiveWorkspaceFromCache().uuid) {
return [userContextId, true, workspace.uuid];
}
}
return [userContextId, false];
}
const activeWorkspace = this.getActiveWorkspaceFromCache();
@@ -3056,9 +2987,9 @@ class nsZenWorkspaces {
typeof userContextId !== "undefined" &&
userContextId !== activeWorkspaceUserContextId
) {
return [userContextId, false, undefined];
return [userContextId, false];
}
return [activeWorkspaceUserContextId, true, undefined];
return [activeWorkspaceUserContextId, true];
}
getTabsToExclude(aTab) {

View File

@@ -1229,11 +1229,7 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
const newTab = this.openAndSwitchToTab(url, {
skipRoute: true,
inBackground: false,
triggeringPrincipal: window.gContextMenu.principal,
});
if (!newTab) {
return;
}
this.splitTabs([currentTab, newTab], undefined, 1);
}
@@ -1244,17 +1240,13 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
*/
contextSplitTabs(otherTabHint = null) {
let tabs;
let currentTab = gZenGlanceManager.getTabOrGlanceParent(
TabContextMenu.contextTab || gBrowser.selectedTab
);
let currentTab = TabContextMenu.contextTab || gBrowser.selectedTab;
if (currentTab.multiselected) {
tabs = gBrowser.selectedTabs;
} else if (!currentTab.selected && !currentTab.splitView) {
tabs = [
currentTab,
...gBrowser.selectedTabs.filter(
t => t !== currentTab && !t.hasAttribute("zen-glance-tab")
),
...gBrowser.selectedTabs.filter(t => t !== currentTab),
];
} else {
tabs = [currentTab];
@@ -1983,24 +1975,9 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
* @returns {tab} The tab that was opened
*/
openAndSwitchToTab(url, options) {
const triggeringPrincipal = options?.triggeringPrincipal;
if (!triggeringPrincipal) {
return null;
}
try {
Services.scriptSecurityManager.checkLoadURIStrWithPrincipal(
triggeringPrincipal,
url
);
} catch {
return null;
}
const parentWindow = window.parent;
const targetWindow = parentWindow || window;
const tab = targetWindow.gBrowser.addTab(url, {
...options,
triggeringPrincipal,
});
const tab = targetWindow.gBrowser.addTrustedTab(url, options);
targetWindow.gBrowser.selectedTab = tab;
return tab;
}

View File

@@ -246,66 +246,6 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
gZenUIManager.showToast("zen-pinned-tab-replaced");
}
async editPinnedUrl(tab = undefined) {
tab ??= TabContextMenu.contextTab;
if (!tab || !tab.pinned) {
return;
}
const initialUrl =
tab._zenPinnedInitialState?.entry?.url ||
tab.linkedBrowser?.currentURI?.spec;
const [title, label] = await document.l10n.formatValues([
{ id: "zen-pinned-tab-edit-url-title" },
{ id: "zen-pinned-tab-edit-url-label" },
]);
const result = { value: initialUrl ?? "" };
const confirmed = Services.prompt.prompt(
window,
title,
label,
result,
null,
{ value: false }
);
if (!confirmed) {
return;
}
let uri;
try {
uri = Services.uriFixup.getFixupURIInfo(
result.value.trim(),
Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS
).preferredURI;
} catch (_) {}
if (!uri) {
gZenUIManager.showToast("zen-pinned-tab-url-invalid");
return;
}
const url = uri.spec;
// Skip when the value wasn't actually changed from what was prefilled.
if (!url || url === initialUrl) {
return;
}
const image = tab.zenStaticIcon || (await this.#getCachedFavicon(uri));
window.gZenWindowSync.setPinnedUrl(tab, url, image);
this.#resetTabToStoredState(tab);
gZenUIManager.showToast("zen-pinned-tab-url-edited");
}
async #getCachedFavicon(uri) {
try {
const favicon = await PlacesUtils.favicons.getFaviconForPage(uri);
return favicon?.dataURI?.spec;
} catch (ex) {
console.error("Failed to get favicon for edited pinned url:", ex);
return null;
}
}
_initClosePinnedTabShortcut() {
let cmdClose = document.getElementById("cmd_close");
@@ -605,20 +545,11 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
}
const elements = window.MozXULElement.parseXULToFragment(`
<menuseparator id="context_zen-pinned-tab-separator" hidden="true"/>
<menu id="context_zen-edit-pinned-page"
data-lazy-l10n-id="tab-context-zen-edit-pinned-page"
data-l10n-args="{&quot;isEssential&quot;:&quot;&quot;}"
hidden="true">
<menupopup>
<menuitem id="context_zen-replace-pinned-url-with-current"
data-lazy-l10n-id="tab-context-zen-replace-pinned-url-with-current"
data-l10n-args="{&quot;isEssential&quot;:&quot;&quot;}"
command="cmd_zenReplacePinnedUrlWithCurrent"/>
<menuitem id="context_zen-edit-pinned-url"
data-lazy-l10n-id="tab-context-zen-edit-pinned-url"
command="cmd_zenEditPinnedUrl"/>
</menupopup>
</menu>
<menuitem id="context_zen-replace-pinned-url-with-current"
data-lazy-l10n-id="tab-context-zen-replace-pinned-url-with-current"
data-l10n-args="{&quot;isEssential&quot;:&quot;&quot;}"
hidden="true"
command="cmd_zenReplacePinnedUrlWithCurrent"/>
<menuitem id="context_zen-reset-pinned-tab"
data-lazy-l10n-id="tab-context-zen-reset-pinned-tab"
data-l10n-args="{&quot;isEssential&quot;:&quot;&quot;}"
@@ -688,24 +619,15 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
const zenResetPinnedTab = document.getElementById(
"context_zen-reset-pinned-tab"
);
const zenEditPinnedPage = document.getElementById(
"context_zen-edit-pinned-page"
);
const zenReplacePinnedUrl = document.getElementById(
"context_zen-replace-pinned-url-with-current"
);
[zenResetPinnedTab, zenEditPinnedPage].forEach(element => {
[zenResetPinnedTab, zenReplacePinnedUrl].forEach(element => {
if (element) {
element.hidden = !isVisible;
document.l10n.setArgs(element, { isEssential });
}
});
[zenResetPinnedTab, zenEditPinnedPage, zenReplacePinnedUrl].forEach(
element => {
if (element) {
document.l10n.setArgs(element, { isEssential });
}
}
);
zenAddEssential.hidden = isEssential || !!contextTab.group;
document.l10n
.formatValue("tab-context-zen-add-essential-badge", {
@@ -935,7 +857,7 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
) {
return;
}
// Remove # from the URL
// Remove # and ? from the URL
const pinUrl = tab._zenPinnedInitialState.entry.url.split("#")[0];
const currentUrl = location.split("#")[0];
// Add an indicator that the pin has been changed
@@ -975,14 +897,10 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
} else {
tab.setAttribute("zen-pinned-changed", "true");
}
if (tab._zenPinnedInitialState.image) {
tab.style.setProperty(
"--zen-original-tab-icon",
`url(${tab._zenPinnedInitialState.image})`
);
} else {
tab.style.removeProperty("--zen-original-tab-icon");
}
tab.style.setProperty(
"--zen-original-tab-icon",
`url(${tab._zenPinnedInitialState.image})`
);
}
removeTabContainersDragoverClass(hideIndicator = true) {

View File

@@ -13,8 +13,6 @@ prefs = ["zen.workspaces.separate-essentials=false"]
["browser_pinned_created.js"]
["browser_pinned_edit_url.js"]
["browser_pinned_nounload_reset.js"]
["browser_pinned_reset_button.js"]

View File

@@ -1,384 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
async function pinTab(url) {
const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
gBrowser.pinTab(tab);
await gBrowser.TabStateFlusher.flush(tab.linkedBrowser);
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
await new Promise(r => setTimeout(r, 500));
return tab;
}
// XPCOM service methods can't be stubbed in place (non-configurable), so we
// swap the whole service object out for a mock and restore it afterwards.
function mockPrompt(value) {
const original = Services.prompt;
Services.prompt = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIPromptService]),
prompt(win, title, label, result) {
if (value === null) {
return false; // user cancelled
}
result.value = value;
return true;
},
};
return () => {
Services.prompt = original;
};
}
function mockFavicons(faviconSpec) {
const original = PlacesUtils.favicons;
const mock = {
callCount: 0,
defaultFavicon: { spec: "data:image/png;base64,DEFAULT" },
getFaviconForPage() {
mock.callCount++;
return Promise.resolve(
faviconSpec ? { dataURI: { spec: faviconSpec } } : null
);
},
};
PlacesUtils.favicons = mock;
return {
mock,
restore: () => {
PlacesUtils.favicons = original;
},
};
}
add_task(async function test_EditPinnedUrl_SurvivesRebuild() {
// Pinned tab at url1 (loaded), then select a different tab (unfocus it).
const tab = await pinTab("https://example.com/1");
const other = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"https://example.com/other"
);
const editedUrl = "https://example.com/edited";
const restorePrompt = mockPrompt(editedUrl);
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
// Close + re-open rebuilds the tab: the in-memory _zenPinnedInitialState is
// gone and gets reconstructed from the persisted session via
// setPinnedTabState (exactly what #onSessionStoreInitialized does).
delete tab._zenPinnedInitialState;
await window.gZenWindowSync.setPinnedTabState(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
editedUrl,
"After the tab is rebuilt, the pinned URL should still be the edited one"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(other);
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_ActiveTabNavigates() {
// Editing the active (focused) pinned tab applies the new URL immediately:
// the live tab navigates to it (matching Arc's behavior).
const tab = await pinTab("https://example.com/1");
Assert.equal(gBrowser.selectedTab, tab, "the pinned tab should be active");
const editedUrl = "https://example.com/edited";
const restorePrompt = mockPrompt(editedUrl);
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
await BrowserTestUtils.waitForCondition(
() => tab.linkedBrowser.currentURI.spec === editedUrl,
"the active pinned tab to navigate to the edited URL"
);
Assert.equal(
tab.linkedBrowser.currentURI.spec,
editedUrl,
"Editing the active pinned tab should navigate it to the new URL"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(
async function test_EditPinnedUrl_FaviconLookupErrorLeavesImageEmpty() {
const tab = await pinTab("https://example.com/1");
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons(null);
// Simulate a Places DB failure so #getCachedFavicon hits its catch branch.
favicons.mock.getFaviconForPage = () =>
Promise.reject(new Error("simulated favicon DB failure"));
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
"https://example.org/edited",
"The URL should still be updated when the favicon lookup fails"
);
ok(
!tab._zenPinnedInitialState.image,
"The image should be left empty (populated by the next navigation)"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
}
);
add_task(async function test_EditPinnedUrl_UpdatesUrlAndFavicon() {
const tab = await pinTab("https://example.com/1");
const faviconSpec = "data:image/png;base64,iVBORw0KGgo=";
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons(faviconSpec);
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
"https://example.org/edited",
"The pinned URL should be updated to the edited value"
);
Assert.equal(
tab._zenPinnedInitialState.image,
faviconSpec,
"The stored icon should be the cached favicon for the new URL"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_NoCachedFaviconLeavesImageEmpty() {
const tab = await pinTab("https://example.com/1");
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons(null); // no cached favicon for the new URL
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
ok(
!tab._zenPinnedInitialState.image,
"Without a cached favicon the image is left empty, not the default; the " +
"next navigation captures the real icon"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_ClearsStaleTitle() {
const tab = await pinTab("https://example.com/1");
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
ok(
!tab._zenPinnedInitialState.entry.title,
"The previous title is cleared so the new page's title is used on load"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_KeepsCustomLabel() {
const tab = await pinTab("https://example.com/1");
tab.zenStaticLabel = "My Pinned Tab";
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.title,
"My Pinned Tab",
"An explicit custom label is preserved across a URL edit"
);
} finally {
restorePrompt();
favicons.restore();
delete tab.zenStaticLabel;
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_KeepsCustomIcon() {
const tab = await pinTab("https://example.com/1");
const customIcon = "data:image/svg+xml,custom-icon";
tab.zenStaticIcon = customIcon;
const restorePrompt = mockPrompt("https://example.org/edited");
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
"https://example.org/edited",
"The pinned URL should still be updated when a custom icon is set"
);
Assert.equal(
tab._zenPinnedInitialState.image,
customIcon,
"A user-set custom icon should be preserved, not overridden by a favicon"
);
Assert.equal(
favicons.mock.callCount,
0,
"Favicon lookup should be skipped when a custom icon is set"
);
} finally {
restorePrompt();
favicons.restore();
delete tab.zenStaticIcon;
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_InvalidUrlKeepsState() {
const tab = await pinTab("https://example.com/1");
const originalUrl = tab._zenPinnedInitialState.entry.url;
const restorePrompt = mockPrompt(" "); // whitespace only -> not a valid URL
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
originalUrl,
"The pinned URL should be unchanged for invalid input"
);
ok(
!tab.hasAttribute("zen-pinned-changed"),
"The tab should not be marked as changed for invalid input"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_CancelKeepsState() {
const tab = await pinTab("https://example.com/1");
const originalUrl = tab._zenPinnedInitialState.entry.url;
const restorePrompt = mockPrompt(null); // user cancels the dialog
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
originalUrl,
"The pinned URL should be unchanged when the dialog is cancelled"
);
} finally {
restorePrompt();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_FixesSchemeTypo() {
const tab = await pinTab("https://example.com/1");
const restorePrompt = mockPrompt("htps://example.org/typo");
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
tab._zenPinnedInitialState.entry.url,
"https://example.org/typo",
"A mistyped scheme (htps://) should be auto-fixed to https://"
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_AddsMissingScheme() {
const tab = await pinTab("https://example.com/1");
const restorePrompt = mockPrompt("example.org/no-scheme");
const favicons = mockFavicons("data:image/png;base64,iVBORw0KGgo=");
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
const stored = tab._zenPinnedInitialState.entry.url;
ok(
/^https?:\/\//.test(stored),
`A scheme should be prepended when omitted (got "${stored}")`
);
ok(
stored.endsWith("example.org/no-scheme"),
`Host and path should be preserved (got "${stored}")`
);
} finally {
restorePrompt();
favicons.restore();
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_EditPinnedUrl_PrefillsWithStoredUrl() {
const tab = await pinTab("https://example.com/1");
// The stored pinned URL differs from the live browser URL (e.g. it was pinned
// as http but the server redirected the tab to https).
tab._zenPinnedInitialState = {
entry: { url: "http://example.com/pinned" },
image: "",
};
let prefilled;
const originalPrompt = Services.prompt;
Services.prompt = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIPromptService]),
prompt(win, title, label, result) {
prefilled = result.value;
return false; // cancel, we only care about the prefilled value
},
};
try {
await gZenPinnedTabManager.editPinnedUrl(tab);
Assert.equal(
prefilled,
"http://example.com/pinned",
"The edit dialog should prefill with the stored pinned URL, not the live browser URL"
);
} finally {
Services.prompt = originalPrompt;
await BrowserTestUtils.removeTab(tab);
}
});

View File

@@ -5,8 +5,8 @@
"binaryName": "zen",
"version": {
"product": "firefox",
"version": "152.0.4",
"candidate": "152.0.4",
"version": "152.0.1",
"candidate": "152.0.1",
"candidateBuild": 1
},
"buildOptions": {
@@ -20,7 +20,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.21.5b",
"displayVersion": "1.21.3b",
"github": {
"repo": "zen-browser/desktop"
},