11diff --git a/browser/base/content/browser-sidebar.js b/browser/base/content/browser-sidebar.js
2- index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6fb999eef 100644
2+ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..4d824259fd611e5531e35bb3d3da85f587815197 100644
33--- a/browser/base/content/browser-sidebar.js
44+++ b/browser/base/content/browser-sidebar.js
55@@ -11,6 +11,10 @@ var SidebarUI = {
@@ -42,8 +42,8 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
4242 url: "chrome://browser/content/syncedtabs/sidebar.xhtml",
4343 menuId: "menu_tabsSidebar",
4444+ iconurl: "chrome://browser/skin/tab.svg",
45- + }),
46- + ],
45+ }),
46+ ],
4747+ [
4848+ "viewDownloadsSidebar",
4949+ makeSidebar({
@@ -52,8 +52,8 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
5252+ url: "about:downloads",
5353+ menuId: "menu_downloadsSidebar",
5454+ iconurl: "chrome://browser/skin/downloads/downloads.svg",
55- }),
56- ],
55+ + }),
56+ + ],
5757+ [
5858+ "sidebar-view-addons",
5959+ {
@@ -100,7 +100,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
100100 _reversePositionButton: null,
101101 _switcherPanel: null,
102102 _switcherTarget: null,
103- @@ -110,15 +154,58 @@ var SidebarUI = {
103+ @@ -110,15 +154,59 @@ var SidebarUI = {
104104 this._switcherTarget = document.getElementById("sidebar-switcher-target");
105105 this._switcherArrow = document.getElementById("sidebar-switcher-arrow");
106106
@@ -129,10 +129,11 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
129129+ this.createSidebarItem(sidebaritem, this.sidebars.get(sidebaritem), true);
130130+ }
131131+
132- + const sidebarVisible = Services.prefs.getBoolPref(
133- + this.SIDEBAR_TABS_PREF,
134- + true
135- + );
132+ + let sidebarVisible = false;
133+ + if (window.toolbar.visible) {
134+ + sidebarVisible = Services.prefs.getBoolPref(this.SIDEBAR_TABS_PREF, true);
135+ + }
136+ +
136137+ this.setSidebarVisibility(sidebarVisible);
137138+
138139+ // Keep track on the changes of the sidebar visibility
@@ -159,7 +160,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
159160 },
160161
161162 uninit() {
162- @@ -127,7 +214 ,10 @@ var SidebarUI = {
163+ @@ -127,7 +215 ,10 @@ var SidebarUI = {
163164 let enumerator = Services.wm.getEnumerator("navigator:browser");
164165 if (!enumerator.hasMoreElements()) {
165166 let xulStore = Services.xulStore;
@@ -171,7 +172,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
171172
172173 if (this._box.hasAttribute("positionend")) {
173174 xulStore.persist(this._box, "positionend");
174- @@ -148,6 +238 ,12 @@ var SidebarUI = {
175+ @@ -148,6 +239 ,12 @@ var SidebarUI = {
175176 xulStore.persist(this._title, "value");
176177 }
177178
@@ -184,7 +185,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
184185 Services.obs.removeObserver(this, "intl:app-locales-changed");
185186
186187 if (this._observer) {
187- @@ -159,17 +255 ,47 @@ var SidebarUI = {
188+ @@ -159,17 +256 ,47 @@ var SidebarUI = {
188189 /**
189190 * The handler for Services.obs.addObserver.
190191 **/
@@ -236,7 +237,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
236237 }
237238 }
238239 },
239- @@ -485,6 +611 ,9 @@ var SidebarUI = {
240+ @@ -485,6 +612 ,9 @@ var SidebarUI = {
240241 },
241242
242243 _loadSidebarExtension(commandID) {
@@ -246,15 +247,15 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
246247 let sidebar = this.sidebars.get(commandID);
247248 let { extensionId } = sidebar;
248249 if (extensionId) {
249- @@ -523,6 +652 ,7 @@ var SidebarUI = {
250+ @@ -523,6 +653 ,7 @@ var SidebarUI = {
250251 }
251252
252253 this._fireFocusedEvent();
253254+ this.loadedSidebars.push(commandID);
254255 return true;
255256 });
256257 },
257- @@ -546,10 +676 ,28 @@ var SidebarUI = {
258+ @@ -546,10 +677 ,28 @@ var SidebarUI = {
258259 }
259260 return this._show(commandID).then(() => {
260261 this._loadSidebarExtension(commandID);
@@ -283,7 +284,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
283284 /**
284285 * Implementation for show. Also used internally for sidebars that are shown
285286 * when a window is opened and we don't want to ping telemetry.
286- @@ -559,6 +707 ,29 @@ var SidebarUI = {
287+ @@ -559,6 +708 ,29 @@ var SidebarUI = {
287288 */
288289 _show(commandID) {
289290 return new Promise(resolve => {
@@ -313,7 +314,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
313314 this.selectMenuItem(commandID);
314315
315316 this._box.hidden = this._splitter.hidden = false;
316- @@ -570,13 +741 ,21 @@ var SidebarUI = {
317+ @@ -570,13 +742 ,21 @@ var SidebarUI = {
317318 this._box.setAttribute("sidebarcommand", commandID);
318319 this.lastOpenedId = commandID;
319320
@@ -337,7 +338,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
337338 this.browser.addEventListener(
338339 "load",
339340 event => {
340- @@ -615,22 +794 ,46 @@ var SidebarUI = {
341+ @@ -615,22 +795 ,46 @@ var SidebarUI = {
341342
342343 this.selectMenuItem("");
343344
@@ -391,7 +392,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
391392 },
392393
393394 /**
394- @@ -638,25 +841 ,121 @@ var SidebarUI = {
395+ @@ -638,25 +842 ,121 @@ var SidebarUI = {
395396 * none if the argument is an empty string.
396397 */
397398 selectMenuItem(commandID) {
0 commit comments