mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1460910 - Allow sidebar to be closed at install. r=mixedpuppy
MozReview-Commit-ID: 5UWW7DNQKzr --HG-- extra : rebase_source : 7613b25201b248310f74862585fc507042445804
This commit is contained in:
parent
7bc7122170
commit
828ab007c4
@ -108,6 +108,10 @@ this.sidebarAction = class extends ExtensionAPI {
|
||||
if (SidebarUI.currentID === this.id) {
|
||||
SidebarUI.hide();
|
||||
}
|
||||
if (SidebarUI.lastOpenedId === this.id &&
|
||||
reason === "ADDON_UNINSTALL") {
|
||||
SidebarUI.lastOpenedId = null;
|
||||
}
|
||||
let menu = document.getElementById(this.menuId);
|
||||
if (menu) {
|
||||
menu.remove();
|
||||
@ -135,7 +139,8 @@ this.sidebarAction = class extends ExtensionAPI {
|
||||
for (let window of windowTracker.browserWindows()) {
|
||||
this.updateWindow(window);
|
||||
let {SidebarUI} = window;
|
||||
if (install || SidebarUI.lastOpenedId == this.id) {
|
||||
if ((install && this.extension.manifest.sidebar_action.open_at_install) ||
|
||||
SidebarUI.lastOpenedId == this.id) {
|
||||
SidebarUI.show(this.id);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,12 @@
|
||||
"type": "string",
|
||||
"format": "strictRelativeUrl",
|
||||
"preprocess": "localize"
|
||||
},
|
||||
"open_at_install": {
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"default": true,
|
||||
"description": "Whether or not the sidebar is opened at install. Default is <code>true</code>."
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
|
@ -70,8 +70,8 @@ add_task(async function sidebar_initial_install() {
|
||||
ok(document.getElementById("sidebar-box").hidden, "sidebar box is not visible");
|
||||
let extension = ExtensionTestUtils.loadExtension(getExtData());
|
||||
await extension.startup();
|
||||
|
||||
// Test sidebar is opened on install
|
||||
await extension.awaitMessage("sidebar");
|
||||
ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible");
|
||||
|
||||
await extension.unload();
|
||||
@ -79,6 +79,20 @@ add_task(async function sidebar_initial_install() {
|
||||
ok(document.getElementById("sidebar-box").hidden, "sidebar box is not visible");
|
||||
});
|
||||
|
||||
add_task(async function sidebar__install_closed() {
|
||||
ok(document.getElementById("sidebar-box").hidden, "sidebar box is not visible");
|
||||
let tempExtData = getExtData();
|
||||
tempExtData.manifest.sidebar_action.open_at_install = false;
|
||||
let extension = ExtensionTestUtils.loadExtension(tempExtData);
|
||||
await extension.startup();
|
||||
|
||||
// Test sidebar is closed on install
|
||||
ok(document.getElementById("sidebar-box").hidden, "sidebar box is hidden");
|
||||
|
||||
await extension.unload();
|
||||
// This is the default value
|
||||
tempExtData.manifest.sidebar_action.open_at_install = true;
|
||||
});
|
||||
|
||||
add_task(async function sidebar_two_sidebar_addons() {
|
||||
let extension2 = ExtensionTestUtils.loadExtension(getExtData());
|
||||
|
Loading…
Reference in New Issue
Block a user