Bug 1338727 add command support for sidebar-action, r=aswan

MozReview-Commit-ID: Jp1cuTzsDz4
This commit is contained in:
Shane Caraveo
2017-02-14 16:24:03 -08:00
parent 154bc10d66
commit 4e556465b9
5 changed files with 77 additions and 4 deletions

View File

@@ -125,16 +125,22 @@ CommandList.prototype = {
// We remove all references to the key elements when the extension is shutdown,
// therefore the listeners for these elements will be garbage collected.
keyElement.addEventListener("command", (event) => {
let action;
if (name == "_execute_page_action") {
let win = event.target.ownerGlobal;
pageActionFor(this.extension).triggerAction(win);
action = pageActionFor(this.extension);
} else if (name == "_execute_browser_action") {
let win = event.target.ownerGlobal;
browserActionFor(this.extension).triggerAction(win);
action = browserActionFor(this.extension);
} else if (name == "_execute_sidebar_action") {
action = sidebarActionFor(this.extension);
} else {
this.extension.tabManager
.addActiveTabPermission();
this.emit("command", name);
return;
}
if (action) {
let win = event.target.ownerGlobal;
action.triggerAction(win);
}
});
/* eslint-enable mozilla/balanced-listeners */