|
1 | 1 | diff --git a/browser/base/content/browser-addons.js b/browser/base/content/browser-addons.js |
2 | | -index fadcbfca95ee28140579430c0371baad0e2f216a..7454b801b4ad892d6ad122277eb7c7736e976f9f 100644 |
| 2 | +index fadcbfca95ee28140579430c0371baad0e2f216a..22a92ca450ef5087610169b15d7f3344c9accddf 100644 |
3 | 3 | --- a/browser/base/content/browser-addons.js |
4 | 4 | +++ b/browser/base/content/browser-addons.js |
5 | 5 | @@ -1069,7 +1069,7 @@ var gXPInstallObserver = { |
@@ -38,37 +38,131 @@ index fadcbfca95ee28140579430c0371baad0e2f216a..7454b801b4ad892d6ad122277eb7c773 |
38 | 38 | } |
39 | 39 |
|
40 | 40 | return anchorID; |
41 | | -@@ -2657,11 +2657,7 @@ var gUnifiedExtensions = { |
42 | | - // Lazy load the unified-extensions-panel panel the first time we need to |
43 | | - // display it. |
44 | | - if (!this._panel) { |
45 | | -- let template = document.getElementById( |
46 | | -- "unified-extensions-panel-template" |
47 | | -- ); |
48 | | -- template.replaceWith(template.content); |
49 | | -- this._panel = document.getElementById("unified-extensions-panel"); |
50 | | -+ this._panel = document.getElementById("zen-unified-site-data-panel"); |
51 | | - let customizationArea = this._panel.querySelector( |
52 | | - "#unified-extensions-area" |
| 41 | +@@ -2547,7 +2547,7 @@ var gUnifiedExtensions = { |
| 42 | + requestAnimationFrame(() => this.updateAttention()); |
| 43 | + }, |
| 44 | + |
| 45 | +- onToolbarVisibilityChange(toolbarId, isVisible) { |
| 46 | ++ onToolbarVisibilityChange(toolbarId, isVisible, panel = this.panel) { |
| 47 | + // A list of extension widget IDs (possibly empty). |
| 48 | + let widgetIDs; |
| 49 | + |
| 50 | +@@ -2561,7 +2561,7 @@ var gUnifiedExtensions = { |
| 51 | + } |
| 52 | + |
| 53 | + // The list of overflowed extensions in the extensions panel. |
| 54 | +- const overflowedExtensionsList = this.panel.querySelector( |
| 55 | ++ const overflowedExtensionsList = panel.querySelector( |
| 56 | + "#overflowed-extensions-list" |
| 57 | + ); |
| 58 | + |
| 59 | +@@ -2662,37 +2662,41 @@ var gUnifiedExtensions = { |
53 | 60 | ); |
54 | | -@@ -2714,6 +2710,7 @@ var gUnifiedExtensions = { |
55 | | - // and no alternative content is available for display in the panel. |
56 | | - const policies = this.getActivePolicies(); |
| 61 | + template.replaceWith(template.content); |
| 62 | + this._panel = document.getElementById("unified-extensions-panel"); |
| 63 | +- let customizationArea = this._panel.querySelector( |
| 64 | +- "#unified-extensions-area" |
| 65 | +- ); |
| 66 | +- CustomizableUI.registerPanelNode( |
| 67 | +- customizationArea, |
| 68 | +- CustomizableUI.AREA_ADDONS |
| 69 | +- ); |
| 70 | +- CustomizableUI.addPanelCloseListeners(this._panel); |
| 71 | +- |
| 72 | +- this._panel |
| 73 | +- .querySelector("#unified-extensions-manage-extensions") |
| 74 | +- .addEventListener("command", () => { |
| 75 | +- BrowserAddonUI.openAddonsMgr("addons://list/extension"); |
| 76 | +- }); |
| 77 | +- |
| 78 | +- // Lazy-load the l10n strings. Those strings are used for the CUI and |
| 79 | +- // non-CUI extensions in the unified extensions panel. |
| 80 | +- document |
| 81 | +- .getElementById("unified-extensions-context-menu") |
| 82 | +- .querySelectorAll("[data-lazy-l10n-id]") |
| 83 | +- .forEach(el => { |
| 84 | +- el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id")); |
| 85 | +- el.removeAttribute("data-lazy-l10n-id"); |
| 86 | +- }); |
| 87 | ++ this.initializePanel(this._panel); |
| 88 | + } |
| 89 | + return this._panel; |
| 90 | + }, |
| 91 | + |
| 92 | ++ initializePanel(panel) { |
| 93 | ++ let customizationArea = panel.querySelector( |
| 94 | ++ "#unified-extensions-area" |
| 95 | ++ ); |
| 96 | ++ CustomizableUI.registerPanelNode( |
| 97 | ++ customizationArea, |
| 98 | ++ CustomizableUI.AREA_ADDONS |
| 99 | ++ ); |
| 100 | ++ CustomizableUI.addPanelCloseListeners(panel); |
| 101 | ++ |
| 102 | ++ panel |
| 103 | ++ .querySelector("#unified-extensions-manage-extensions") |
| 104 | ++ .addEventListener("command", () => { |
| 105 | ++ BrowserAddonUI.openAddonsMgr("addons://list/extension"); |
| 106 | ++ }); |
| 107 | ++ |
| 108 | ++ // Lazy-load the l10n strings. Those strings are used for the CUI and |
| 109 | ++ // non-CUI extensions in the unified extensions panel. |
| 110 | ++ document |
| 111 | ++ .getElementById("unified-extensions-context-menu") |
| 112 | ++ .querySelectorAll("[data-lazy-l10n-id]") |
| 113 | ++ .forEach(el => { |
| 114 | ++ el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id")); |
| 115 | ++ el.removeAttribute("data-lazy-l10n-id"); |
| 116 | ++ }); |
| 117 | ++ }, |
| 118 | ++ |
| 119 | + // `aEvent` and `reason` are optional. If `reason` is specified, it should be |
| 120 | + // a valid argument to gUnifiedExtensions.recordButtonTelemetry(). |
| 121 | +- async togglePanel(aEvent, reason) { |
| 122 | ++ async togglePanel(aEvent, reason, panel = this._panel, view = "unified-extensions-view", button = this._button) { |
| 123 | + if (!CustomizationHandler.isCustomizing()) { |
| 124 | + if (aEvent) { |
57 | 125 | if ( |
58 | | -+ false && |
59 | | - policies.length && |
60 | | - !this.hasExtensionsInPanel(policies) && |
61 | | - !this.isPrivateWindowMissingExtensionsWithoutPBMAccess() && |
62 | | -@@ -2754,7 +2751,7 @@ var gUnifiedExtensions = { |
| 126 | +@@ -2729,32 +2733,30 @@ var gUnifiedExtensions = { |
| 127 | + this.blocklistAttentionInfo = |
| 128 | + await AddonManager.getBlocklistAttentionInfo(); |
| 129 | + |
| 130 | +- let panel = this.panel; |
| 131 | +- |
| 132 | + if (!this._listView) { |
| 133 | + this._listView = PanelMultiView.getViewNode( |
| 134 | + document, |
| 135 | +- "unified-extensions-view" |
| 136 | ++ view, |
| 137 | + ); |
| 138 | + this._listView.addEventListener("ViewShowing", this); |
| 139 | + this._listView.addEventListener("ViewHiding", this); |
| 140 | + } |
| 141 | + |
| 142 | +- if (this._button.open) { |
| 143 | ++ if (button.open) { |
| 144 | + PanelMultiView.hidePopup(panel); |
| 145 | +- this._button.open = false; |
| 146 | ++ button.open = false; |
| 147 | + } else { |
| 148 | + // Overflow extensions placed in collapsed toolbars, if any. |
| 149 | + for (const toolbarId of CustomizableUI.getCollapsedToolbarIds(window)) { |
| 150 | + // We pass `false` because all these toolbars are collapsed. |
| 151 | +- this.onToolbarVisibilityChange(toolbarId, /* isVisible */ false); |
| 152 | ++ this.onToolbarVisibilityChange(toolbarId, /* isVisible */ false, panel); |
| 153 | + } |
| 154 | + |
| 155 | + panel.hidden = false; |
63 | 156 | this.recordButtonTelemetry(reason || "extensions_panel_showing"); |
64 | 157 | this.ensureButtonShownBeforeAttachingPanel(panel); |
65 | | - PanelMultiView.openPopup(panel, this._button, { |
| 158 | +- PanelMultiView.openPopup(panel, this._button, { |
66 | 159 | - position: "bottomright topright", |
67 | | -+ position: gZenUIManager.panelUIPosition(panel, this._button), |
| 160 | ++ PanelMultiView.openPopup(panel, button, { |
| 161 | ++ position: gZenUIManager.panelUIPosition(panel, button), |
68 | 162 | triggerEvent: aEvent, |
69 | 163 | }); |
70 | 164 | } |
71 | | -@@ -2941,18 +2938,20 @@ var gUnifiedExtensions = { |
| 165 | +@@ -2941,18 +2943,20 @@ var gUnifiedExtensions = { |
72 | 166 | this._maybeMoveWidgetNodeBack(widgetId); |
73 | 167 | } |
74 | 168 |
|
|
0 commit comments