Bug 1362445 - Fix _action context menus when module is not loaded r=bsilverberg,mixedpuppy
authorTomislav Jovanovic <tomica@gmail.com>
Sun, 07 May 2017 21:38:01 +0200
changeset 357142 2c8fe990d360061692ba5399457f16d7c3463111
parent 357141 f63b9bbe87b7a6622a446cf2c00a7ef60604341f
child 357143 3b2a1a474990f7a99f3130a32665bb323473b6a7
push id31783
push usercbook@mozilla.com
push dateTue, 09 May 2017 12:03:48 +0000
treeherdermozilla-central@b0ff0c5c0a35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsilverberg, mixedpuppy
bugs1362445
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1362445 - Fix _action context menus when module is not loaded r=bsilverberg,mixedpuppy MozReview-Commit-ID: AOzcpXSgy8d
browser/components/extensions/ext-browserAction.js
browser/components/extensions/ext-pageAction.js
--- a/browser/components/extensions/ext-browserAction.js
+++ b/browser/components/extensions/ext-browserAction.js
@@ -280,16 +280,20 @@ this.browserAction = class extends Exten
       case "mouseout":
         if (this.pendingPopup) {
           this.clearPopup();
         }
         break;
 
 
       case "popupshowing":
+        if (!global.actionContextMenu) {
+          break;
+        }
+
         const menu = event.target;
         const trigger = menu.triggerNode;
         const node = window.document.getElementById(this.id);
         const contexts = ["toolbar-context-menu", "customizationPanelItemContextMenu"];
 
         if (contexts.includes(menu.id) && node && isAncestorOrSelf(node, trigger)) {
           global.actionContextMenu({
             extension: this.extension,
@@ -596,9 +600,8 @@ this.browserAction = class extends Exten
           return Promise.resolve(color || [0xd9, 0, 0, 255]);
         },
       },
     };
   }
 };
 
 global.browserActionFor = this.browserAction.for;
-
--- a/browser/components/extensions/ext-pageAction.js
+++ b/browser/components/extensions/ext-pageAction.js
@@ -192,16 +192,20 @@ this.pageAction = class extends Extensio
     switch (event.type) {
       case "click":
         if (event.button === 0) {
           this.handleClick(window);
         }
         break;
 
       case "popupshowing":
+        if (!global.actionContextMenu) {
+          break;
+        }
+
         const menu = event.target;
         const trigger = menu.triggerNode;
 
         if (menu.id === "toolbar-context-menu" && trigger && trigger.id === this.id) {
           global.actionContextMenu({
             extension: this.extension,
             onPageAction: true,
             menu: menu,