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 }...
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

@@ -30,12 +30,12 @@ tab-context-zen-replace-pinned-url-with-current =
.label = Replace with Current URL
.accesskey = C
tab-context-zen-edit-pinned-url =
.label = Edit...
.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.

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

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

View File

@@ -85,8 +85,7 @@ class nsZenGlanceManager extends nsZenDOMOperatedFeature {
menuitem.addEventListener("command", () =>
this.openGlance({
url: gContextMenu.linkURL,
triggeringPrincipal:
Services.scriptSecurityManager.getSystemPrincipal(),
triggeringPrincipal: gContextMenu.principal,
})
);
@@ -354,6 +353,28 @@ 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
*
@@ -371,6 +392,13 @@ 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

@@ -245,10 +245,6 @@ class nsZenSpaceRoutingManager {
if (targetWorkspace) {
workspaces.moveTabToWorkspace(newTab, targetWorkspace.uuid);
if (inBackground) {
return;
}
const mostRecentWindow =
Services.wm.getMostRecentWindow("navigator:browser");
const isOriginatingWindow = win === mostRecentWindow;
@@ -256,7 +252,10 @@ class nsZenSpaceRoutingManager {
win.gZenWorkspaces.lastSelectedWorkspaceTabs[
targetWorkspace.uuid
] = 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.profilesPopup.addEventListener(
"popupshown",
this.onProfilePopupShown.bind(this)
"popupshowing",
this.onProfilePopupShowing.bind(this)
);
this.profilesPopup.addEventListener(
"command",
@@ -296,7 +296,7 @@ class nsZenWorkspaceCreation extends MozXULElement {
this.profilesPopup.openPopup(event.target, "after_start");
}
onProfilePopupShown(event) {
onProfilePopupShowing(event) {
return window.createUserContextMenu(event, {
isContextMenu: true,
showDefaultTab: true,

View File

@@ -1229,7 +1229,11 @@ 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);
}
@@ -1979,9 +1983,24 @@ 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.addTrustedTab(url, options);
const tab = targetWindow.gBrowser.addTab(url, {
...options,
triggeringPrincipal,
});
targetWindow.gBrowser.selectedTab = tab;
return tab;
}