Compare commits

..

6 Commits
1.21.4b ... dev

9 changed files with 75 additions and 25 deletions

View File

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

View File

@@ -30,12 +30,12 @@ tab-context-zen-replace-pinned-url-with-current =
.label = Replace with Current URL .label = Replace with Current URL
.accesskey = C .accesskey = C
tab-context-zen-edit-pinned-url = tab-context-zen-edit-pinned-url =
.label = Edit... .label = Edit
.accesskey = E .accesskey = E
tab-context-zen-edit-title = tab-context-zen-edit-title =
.label = Change Label... .label = Change Label
tab-context-zen-edit-icon = 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-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. zen-shortcuts-corrupted = Your { -brand-short-name } shortcuts file is corrupted. They have been reset to the default shortcuts.

View File

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

View File

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

View File

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

View File

@@ -85,8 +85,7 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
menuitem.addEventListener("command", () => menuitem.addEventListener("command", () =>
this.openGlance({ this.openGlance({
url: gContextMenu.linkURL, url: gContextMenu.linkURL,
triggeringPrincipal: triggeringPrincipal: gContextMenu.principal,
Services.scriptSecurityManager.getSystemPrincipal(),
}) })
); );
@@ -354,6 +353,28 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
return this.#lastLinkClickData; 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 * Open a glance overlay with the specified data
* *
@@ -371,6 +392,13 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
return Promise.resolve(this.#currentTab); 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) { if (!data.height || !data.width) {
data = { data = {
...data, ...data,

View File

@@ -245,10 +245,6 @@ class nsZenSpaceRoutingManager {
if (targetWorkspace) { if (targetWorkspace) {
workspaces.moveTabToWorkspace(newTab, targetWorkspace.uuid); workspaces.moveTabToWorkspace(newTab, targetWorkspace.uuid);
if (inBackground) {
return;
}
const mostRecentWindow = const mostRecentWindow =
Services.wm.getMostRecentWindow("navigator:browser"); Services.wm.getMostRecentWindow("navigator:browser");
const isOriginatingWindow = win === mostRecentWindow; const isOriginatingWindow = win === mostRecentWindow;
@@ -256,7 +252,10 @@ class nsZenSpaceRoutingManager {
win.gZenWorkspaces.lastSelectedWorkspaceTabs[ win.gZenWorkspaces.lastSelectedWorkspaceTabs[
targetWorkspace.uuid targetWorkspace.uuid
] = newTab; ] = newTab;
await win.gZenWorkspaces.changeWorkspace(targetWorkspace);
if (!inBackground) {
await win.gZenWorkspaces.changeWorkspace(targetWorkspace);
}
} }
} }
} }

View File

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

View File

@@ -1229,7 +1229,11 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
const newTab = this.openAndSwitchToTab(url, { const newTab = this.openAndSwitchToTab(url, {
skipRoute: true, skipRoute: true,
inBackground: false, inBackground: false,
triggeringPrincipal: window.gContextMenu.principal,
}); });
if (!newTab) {
return;
}
this.splitTabs([currentTab, newTab], undefined, 1); this.splitTabs([currentTab, newTab], undefined, 1);
} }
@@ -1979,9 +1983,24 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
* @returns {tab} The tab that was opened * @returns {tab} The tab that was opened
*/ */
openAndSwitchToTab(url, options) { 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 parentWindow = window.parent;
const targetWindow = parentWindow || window; const targetWindow = parentWindow || window;
const tab = targetWindow.gBrowser.addTrustedTab(url, options); const tab = targetWindow.gBrowser.addTab(url, {
...options,
triggeringPrincipal,
});
targetWindow.gBrowser.selectedTab = tab; targetWindow.gBrowser.selectedTab = tab;
return tab; return tab;
} }