Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Hide Sidebar on Simple Window (Popup) #182

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions src/browser/base/content/browser-sidebar-js.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/browser/base/content/browser-sidebar.js b/browser/base/content/browser-sidebar.js
index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6fb999eef 100644
index c5ac301416d2d820ba95e21c0ce1fe305e63b554..4d824259fd611e5531e35bb3d3da85f587815197 100644
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -11,6 +11,10 @@ var SidebarUI = {
Expand Down Expand Up @@ -42,8 +42,8 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
url: "chrome://browser/content/syncedtabs/sidebar.xhtml",
menuId: "menu_tabsSidebar",
+ iconurl: "chrome://browser/skin/tab.svg",
+ }),
+ ],
}),
],
+ [
+ "viewDownloadsSidebar",
+ makeSidebar({
Expand All @@ -52,8 +52,8 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
+ url: "about:downloads",
+ menuId: "menu_downloadsSidebar",
+ iconurl: "chrome://browser/skin/downloads/downloads.svg",
}),
],
+ }),
+ ],
+ [
+ "sidebar-view-addons",
+ {
Expand Down Expand Up @@ -100,7 +100,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
_reversePositionButton: null,
_switcherPanel: null,
_switcherTarget: null,
@@ -110,15 +154,58 @@ var SidebarUI = {
@@ -110,15 +154,59 @@ var SidebarUI = {
this._switcherTarget = document.getElementById("sidebar-switcher-target");
this._switcherArrow = document.getElementById("sidebar-switcher-arrow");

Expand Down Expand Up @@ -129,10 +129,11 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
+ this.createSidebarItem(sidebaritem, this.sidebars.get(sidebaritem), true);
+ }
+
+ const sidebarVisible = Services.prefs.getBoolPref(
+ this.SIDEBAR_TABS_PREF,
+ true
+ );
+ let sidebarVisible = false;
+ if (window.toolbar.visible) {
+ sidebarVisible = Services.prefs.getBoolPref(this.SIDEBAR_TABS_PREF, true);
+ }
+
+ this.setSidebarVisibility(sidebarVisible);
+
+ // Keep track on the changes of the sidebar visibility
Expand All @@ -159,7 +160,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
},

uninit() {
@@ -127,7 +214,10 @@ var SidebarUI = {
@@ -127,7 +215,10 @@ var SidebarUI = {
let enumerator = Services.wm.getEnumerator("navigator:browser");
if (!enumerator.hasMoreElements()) {
let xulStore = Services.xulStore;
Expand All @@ -171,7 +172,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6

if (this._box.hasAttribute("positionend")) {
xulStore.persist(this._box, "positionend");
@@ -148,6 +238,12 @@ var SidebarUI = {
@@ -148,6 +239,12 @@ var SidebarUI = {
xulStore.persist(this._title, "value");
}

Expand All @@ -184,7 +185,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
Services.obs.removeObserver(this, "intl:app-locales-changed");

if (this._observer) {
@@ -159,17 +255,47 @@ var SidebarUI = {
@@ -159,17 +256,47 @@ var SidebarUI = {
/**
* The handler for Services.obs.addObserver.
**/
Expand Down Expand Up @@ -236,7 +237,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
}
}
},
@@ -485,6 +611,9 @@ var SidebarUI = {
@@ -485,6 +612,9 @@ var SidebarUI = {
},

_loadSidebarExtension(commandID) {
Expand All @@ -246,15 +247,15 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
let sidebar = this.sidebars.get(commandID);
let { extensionId } = sidebar;
if (extensionId) {
@@ -523,6 +652,7 @@ var SidebarUI = {
@@ -523,6 +653,7 @@ var SidebarUI = {
}

this._fireFocusedEvent();
+ this.loadedSidebars.push(commandID);
return true;
});
},
@@ -546,10 +676,28 @@ var SidebarUI = {
@@ -546,10 +677,28 @@ var SidebarUI = {
}
return this._show(commandID).then(() => {
this._loadSidebarExtension(commandID);
Expand Down Expand Up @@ -283,7 +284,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
/**
* Implementation for show. Also used internally for sidebars that are shown
* when a window is opened and we don't want to ping telemetry.
@@ -559,6 +707,29 @@ var SidebarUI = {
@@ -559,6 +708,29 @@ var SidebarUI = {
*/
_show(commandID) {
return new Promise(resolve => {
Expand Down Expand Up @@ -313,7 +314,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
this.selectMenuItem(commandID);

this._box.hidden = this._splitter.hidden = false;
@@ -570,13 +741,21 @@ var SidebarUI = {
@@ -570,13 +742,21 @@ var SidebarUI = {
this._box.setAttribute("sidebarcommand", commandID);
this.lastOpenedId = commandID;

Expand All @@ -337,7 +338,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
this.browser.addEventListener(
"load",
event => {
@@ -615,22 +794,46 @@ var SidebarUI = {
@@ -615,22 +795,46 @@ var SidebarUI = {

this.selectMenuItem("");

Expand Down Expand Up @@ -391,7 +392,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..513dcacbe33770cfafb57bdcadfd64b6
},

/**
@@ -638,25 +841,121 @@ var SidebarUI = {
@@ -638,25 +842,121 @@ var SidebarUI = {
* none if the argument is an empty string.
*/
selectMenuItem(commandID) {
Expand Down