mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-20 13:40:50 +00:00
Merge branch 'window-sync' into drag-and-drop-refactor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/browser-addons.js b/browser/base/content/browser-addons.js
|
||||
index fadcbfca95ee28140579430c0371baad0e2f216a..7454b801b4ad892d6ad122277eb7c7736e976f9f 100644
|
||||
index fadcbfca95ee28140579430c0371baad0e2f216a..1947b4ab1c0b4ba0099147c9f13ae78d6e425bdf 100644
|
||||
--- a/browser/base/content/browser-addons.js
|
||||
+++ b/browser/base/content/browser-addons.js
|
||||
@@ -1069,7 +1069,7 @@ var gXPInstallObserver = {
|
||||
@@ -38,20 +38,92 @@ index fadcbfca95ee28140579430c0371baad0e2f216a..7454b801b4ad892d6ad122277eb7c773
|
||||
}
|
||||
|
||||
return anchorID;
|
||||
@@ -2657,11 +2657,7 @@ var gUnifiedExtensions = {
|
||||
// Lazy load the unified-extensions-panel panel the first time we need to
|
||||
// display it.
|
||||
if (!this._panel) {
|
||||
- let template = document.getElementById(
|
||||
- "unified-extensions-panel-template"
|
||||
- );
|
||||
- template.replaceWith(template.content);
|
||||
- this._panel = document.getElementById("unified-extensions-panel");
|
||||
+ this._panel = document.getElementById("zen-unified-site-data-panel");
|
||||
let customizationArea = this._panel.querySelector(
|
||||
"#unified-extensions-area"
|
||||
@@ -2547,7 +2547,7 @@ var gUnifiedExtensions = {
|
||||
requestAnimationFrame(() => this.updateAttention());
|
||||
},
|
||||
|
||||
- onToolbarVisibilityChange(toolbarId, isVisible) {
|
||||
+ onToolbarVisibilityChange(toolbarId, isVisible, panel = this.panel) {
|
||||
// A list of extension widget IDs (possibly empty).
|
||||
let widgetIDs;
|
||||
|
||||
@@ -2561,7 +2561,7 @@ var gUnifiedExtensions = {
|
||||
}
|
||||
|
||||
// The list of overflowed extensions in the extensions panel.
|
||||
- const overflowedExtensionsList = this.panel.querySelector(
|
||||
+ const overflowedExtensionsList = panel.querySelector(
|
||||
"#overflowed-extensions-list"
|
||||
);
|
||||
|
||||
@@ -2662,37 +2662,41 @@ var gUnifiedExtensions = {
|
||||
);
|
||||
@@ -2714,6 +2710,7 @@ var gUnifiedExtensions = {
|
||||
template.replaceWith(template.content);
|
||||
this._panel = document.getElementById("unified-extensions-panel");
|
||||
- let customizationArea = this._panel.querySelector(
|
||||
- "#unified-extensions-area"
|
||||
- );
|
||||
- CustomizableUI.registerPanelNode(
|
||||
- customizationArea,
|
||||
- CustomizableUI.AREA_ADDONS
|
||||
- );
|
||||
- CustomizableUI.addPanelCloseListeners(this._panel);
|
||||
-
|
||||
- this._panel
|
||||
- .querySelector("#unified-extensions-manage-extensions")
|
||||
- .addEventListener("command", () => {
|
||||
- BrowserAddonUI.openAddonsMgr("addons://list/extension");
|
||||
- });
|
||||
-
|
||||
- // Lazy-load the l10n strings. Those strings are used for the CUI and
|
||||
- // non-CUI extensions in the unified extensions panel.
|
||||
- document
|
||||
- .getElementById("unified-extensions-context-menu")
|
||||
- .querySelectorAll("[data-lazy-l10n-id]")
|
||||
- .forEach(el => {
|
||||
- el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
|
||||
- el.removeAttribute("data-lazy-l10n-id");
|
||||
- });
|
||||
+ this.initializePanel(this._panel);
|
||||
}
|
||||
return this._panel;
|
||||
},
|
||||
|
||||
+ initializePanel(panel) {
|
||||
+ let customizationArea = panel.querySelector(
|
||||
+ "#unified-extensions-area"
|
||||
+ );
|
||||
+ CustomizableUI.registerPanelNode(
|
||||
+ customizationArea,
|
||||
+ CustomizableUI.AREA_ADDONS
|
||||
+ );
|
||||
+ CustomizableUI.addPanelCloseListeners(panel);
|
||||
+
|
||||
+ panel
|
||||
+ .querySelector("#unified-extensions-manage-extensions")
|
||||
+ .addEventListener("command", () => {
|
||||
+ BrowserAddonUI.openAddonsMgr("addons://list/extension");
|
||||
+ });
|
||||
+
|
||||
+ // Lazy-load the l10n strings. Those strings are used for the CUI and
|
||||
+ // non-CUI extensions in the unified extensions panel.
|
||||
+ document
|
||||
+ .getElementById("unified-extensions-context-menu")
|
||||
+ .querySelectorAll("[data-lazy-l10n-id]")
|
||||
+ .forEach(el => {
|
||||
+ el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
|
||||
+ el.removeAttribute("data-lazy-l10n-id");
|
||||
+ });
|
||||
+ },
|
||||
+
|
||||
// `aEvent` and `reason` are optional. If `reason` is specified, it should be
|
||||
// a valid argument to gUnifiedExtensions.recordButtonTelemetry().
|
||||
- async togglePanel(aEvent, reason) {
|
||||
+ async togglePanel(aEvent, reason, panel = this._panel, view = "unified-extensions-view", button = this._button) {
|
||||
if (!CustomizationHandler.isCustomizing()) {
|
||||
if (aEvent) {
|
||||
if (
|
||||
@@ -2714,6 +2718,7 @@ var gUnifiedExtensions = {
|
||||
// and no alternative content is available for display in the panel.
|
||||
const policies = this.getActivePolicies();
|
||||
if (
|
||||
@@ -59,16 +131,46 @@ index fadcbfca95ee28140579430c0371baad0e2f216a..7454b801b4ad892d6ad122277eb7c773
|
||||
policies.length &&
|
||||
!this.hasExtensionsInPanel(policies) &&
|
||||
!this.isPrivateWindowMissingExtensionsWithoutPBMAccess() &&
|
||||
@@ -2754,7 +2751,7 @@ var gUnifiedExtensions = {
|
||||
@@ -2729,32 +2734,30 @@ var gUnifiedExtensions = {
|
||||
this.blocklistAttentionInfo =
|
||||
await AddonManager.getBlocklistAttentionInfo();
|
||||
|
||||
- let panel = this.panel;
|
||||
-
|
||||
if (!this._listView) {
|
||||
this._listView = PanelMultiView.getViewNode(
|
||||
document,
|
||||
- "unified-extensions-view"
|
||||
+ view,
|
||||
);
|
||||
this._listView.addEventListener("ViewShowing", this);
|
||||
this._listView.addEventListener("ViewHiding", this);
|
||||
}
|
||||
|
||||
- if (this._button.open) {
|
||||
+ if (button.open) {
|
||||
PanelMultiView.hidePopup(panel);
|
||||
- this._button.open = false;
|
||||
+ button.open = false;
|
||||
} else {
|
||||
// Overflow extensions placed in collapsed toolbars, if any.
|
||||
for (const toolbarId of CustomizableUI.getCollapsedToolbarIds(window)) {
|
||||
// We pass `false` because all these toolbars are collapsed.
|
||||
- this.onToolbarVisibilityChange(toolbarId, /* isVisible */ false);
|
||||
+ this.onToolbarVisibilityChange(toolbarId, /* isVisible */ false, panel);
|
||||
}
|
||||
|
||||
panel.hidden = false;
|
||||
this.recordButtonTelemetry(reason || "extensions_panel_showing");
|
||||
this.ensureButtonShownBeforeAttachingPanel(panel);
|
||||
PanelMultiView.openPopup(panel, this._button, {
|
||||
- PanelMultiView.openPopup(panel, this._button, {
|
||||
- position: "bottomright topright",
|
||||
+ position: gZenUIManager.panelUIPosition(panel, this._button),
|
||||
+ PanelMultiView.openPopup(panel, button, {
|
||||
+ position: gZenUIManager.panelUIPosition(panel, button),
|
||||
triggerEvent: aEvent,
|
||||
});
|
||||
}
|
||||
@@ -2941,18 +2938,20 @@ var gUnifiedExtensions = {
|
||||
@@ -2941,18 +2944,20 @@ var gUnifiedExtensions = {
|
||||
this._maybeMoveWidgetNodeBack(widgetId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/navigator-toolbox.js b/browser/base/content/navigator-toolbox.js
|
||||
index 7b776b15d52367a008ce6bf53dcfcbbe007b7453..d9a3404905b73db7c8f202ab166d5f3c625351f6 100644
|
||||
index 7b776b15d52367a008ce6bf53dcfcbbe007b7453..da23f716c753f5a43f17bb5ed7a3d335891168c2 100644
|
||||
--- a/browser/base/content/navigator-toolbox.js
|
||||
+++ b/browser/base/content/navigator-toolbox.js
|
||||
@@ -6,7 +6,7 @@
|
||||
@@ -27,21 +27,28 @@ index 7b776b15d52367a008ce6bf53dcfcbbe007b7453..d9a3404905b73db7c8f202ab166d5f3c
|
||||
gBrowser.handleNewTabMiddleClick(element, event);
|
||||
break;
|
||||
|
||||
@@ -315,7 +317,7 @@ document.addEventListener(
|
||||
#pageActionButton,
|
||||
@@ -316,6 +318,7 @@ document.addEventListener(
|
||||
#downloads-button,
|
||||
#fxa-toolbar-menu-button,
|
||||
- #unified-extensions-button,
|
||||
#unified-extensions-button,
|
||||
+ #zen-site-data-icon-button,
|
||||
#library-button
|
||||
`);
|
||||
if (!element) {
|
||||
@@ -394,7 +396,7 @@ document.addEventListener(
|
||||
gSync.toggleAccountPanel(element, event);
|
||||
break;
|
||||
|
||||
- case "unified-extensions-button":
|
||||
+ case "zen-site-data-icon-button":
|
||||
@@ -398,6 +401,16 @@ document.addEventListener(
|
||||
gUnifiedExtensions.togglePanel(event);
|
||||
break;
|
||||
|
||||
+ case "zen-site-data-icon-button":
|
||||
+ gUnifiedExtensions.togglePanel(
|
||||
+ event,
|
||||
+ null,
|
||||
+ window.gZenSiteDataPanel.unifiedPanel,
|
||||
+ window.gZenSiteDataPanel.unifiedPanelView,
|
||||
+ window.gZenSiteDataPanel.anchor,
|
||||
+ );
|
||||
+ break;
|
||||
+
|
||||
case "library-button":
|
||||
PanelUI.showSubView("appMenu-libraryView", element, event);
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
command="Browser:AddBookmarkAs"
|
||||
flex="1" />
|
||||
</hbox>
|
||||
<vbox class="zen-site-data-section">
|
||||
<vbox id="zen-site-data-section-addons" class="zen-site-data-section">
|
||||
<hbox class="zen-site-data-section-header">
|
||||
<label data-l10n-id="unified-extensions-header-title" flex="1" />
|
||||
<label data-l10n-id="zen-generic-manage" id="zen-site-data-manage-addons" />
|
||||
@@ -72,7 +72,7 @@
|
||||
# for this specific button / id
|
||||
<toolbarbutton id="unified-extensions-manage-extensions"
|
||||
class="subviewbutton panel-subview-footer-button unified-extensions-manage-extensions"
|
||||
data-l10n-id="unified-extensions-manage-extensions"
|
||||
data-l10n-id="unified-extensions-manage-extensions"
|
||||
hidden="true" />
|
||||
</vbox>
|
||||
<vbox class="zen-site-data-section">
|
||||
@@ -85,7 +85,7 @@
|
||||
</vbox>
|
||||
</vbox>
|
||||
<hbox id="zen-site-data-footer">
|
||||
<toolbarbutton id="zen-site-data-security-info"
|
||||
<toolbarbutton id="zen-site-data-security-info"
|
||||
class="subviewbutton zen-interactive-button" />
|
||||
<toolbarbutton id="zen-site-data-actions"
|
||||
class="subviewbutton zen-interactive-button"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..5ce4eb0b21cf4ed2b8e7c6ad0c57e77416a2ab48 100644
|
||||
index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..450316b7e18852cc088479e9a5fb5832cee88ace 100644
|
||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
@@ -127,6 +127,8 @@ const TAB_EVENTS = [
|
||||
@@ -133,11 +133,11 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..5ce4eb0b21cf4ed2b8e7c6ad0c57e774
|
||||
// collect the data for all windows
|
||||
for (ix in this._windows) {
|
||||
- if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab) {
|
||||
+ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab || this._windows[ix].isZenUnsynced) {
|
||||
+ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab && !this._windows[ix].isZenUnsynced) {
|
||||
// window data is still in _statesToRestore
|
||||
continue;
|
||||
}
|
||||
@@ -5625,11 +5650,16 @@ var SessionStoreInternal = {
|
||||
@@ -5625,11 +5650,12 @@ var SessionStoreInternal = {
|
||||
}
|
||||
|
||||
let tabbrowser = aWindow.gBrowser;
|
||||
@@ -147,15 +147,21 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..5ce4eb0b21cf4ed2b8e7c6ad0c57e774
|
||||
let winData = this._windows[aWindow.__SSi];
|
||||
let tabsData = (winData.tabs = []);
|
||||
|
||||
+ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null;
|
||||
+ winData.splitViewData = aWindow.gZenViewSplitter?.storeDataForSessionStore();
|
||||
+ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || [];
|
||||
+ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces();
|
||||
+
|
||||
// update the internal state data for this window
|
||||
for (let tab of tabs) {
|
||||
if (tab == aWindow.FirefoxViewHandler.tab) {
|
||||
@@ -5652,7 +5682,7 @@ var SessionStoreInternal = {
|
||||
@@ -5640,6 +5666,9 @@ var SessionStoreInternal = {
|
||||
tabsData.push(tabData);
|
||||
}
|
||||
|
||||
+ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || [];
|
||||
+ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null;
|
||||
+ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces();
|
||||
// update tab group state for this window
|
||||
winData.groups = [];
|
||||
for (let tabGroup of aWindow.gBrowser.tabGroups) {
|
||||
@@ -5652,7 +5681,7 @@ var SessionStoreInternal = {
|
||||
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
||||
// since it's only inserted into the tab strip after it's selected).
|
||||
if (aWindow.FirefoxViewHandler.tab?.selected) {
|
||||
@@ -164,7 +170,7 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..5ce4eb0b21cf4ed2b8e7c6ad0c57e774
|
||||
winData.title = tabbrowser.tabs[0].label;
|
||||
}
|
||||
winData.selected = selectedIndex;
|
||||
@@ -5765,8 +5795,8 @@ var SessionStoreInternal = {
|
||||
@@ -5765,8 +5794,8 @@ var SessionStoreInternal = {
|
||||
// selectTab represents.
|
||||
let selectTab = 0;
|
||||
if (overwriteTabs) {
|
||||
@@ -175,16 +181,24 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..5ce4eb0b21cf4ed2b8e7c6ad0c57e774
|
||||
selectTab = Math.min(selectTab, winData.tabs.length);
|
||||
}
|
||||
|
||||
@@ -5809,6 +5839,9 @@ var SessionStoreInternal = {
|
||||
winData.tabs,
|
||||
winData.groups ?? []
|
||||
);
|
||||
+ aWindow.gZenFolders?.restoreDataFromSessionStore(winData.folders);
|
||||
+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData);
|
||||
+ aWindow.gZenWorkspaces?.restoreWorkspacesFromSessionStore(winData);
|
||||
this._log.debug(
|
||||
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
||||
@@ -5788,6 +5817,7 @@ var SessionStoreInternal = {
|
||||
if (overwriteTabs) {
|
||||
for (let i = tabbrowser.browsers.length - 1; i >= 0; i--) {
|
||||
if (!tabbrowser.tabs[i].selected) {
|
||||
+ aWindow.gZenWorkspaces._shouldOverrideTabs = true;
|
||||
tabbrowser.removeTab(tabbrowser.tabs[i]);
|
||||
}
|
||||
}
|
||||
@@ -5821,6 +5851,9 @@ var SessionStoreInternal = {
|
||||
savedTabGroup => !openTabGroupIdsInWindow.has(savedTabGroup.id)
|
||||
);
|
||||
}
|
||||
+ aWindow.gZenFolders?.restoreDataFromSessionStore(winData.folders);
|
||||
+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData);
|
||||
+ aWindow.gZenWorkspaces?.restoreWorkspacesFromSessionStore(winData);
|
||||
|
||||
// Move the originally open tabs to the end.
|
||||
if (initialTabs) {
|
||||
@@ -6372,6 +6405,25 @@ var SessionStoreInternal = {
|
||||
|
||||
// Most of tabData has been restored, now continue with restoring
|
||||
|
||||
Reference in New Issue
Block a user