Index: lib/ui.js |
=================================================================== |
--- a/lib/ui.js |
+++ b/lib/ui.js |
@@ -1595,24 +1595,35 @@ let UI = exports.UI = |
/** |
* Adds Adblock Plus menu items to the content area context menu when it shows |
* up. |
*/ |
fillContentContextMenu: function(/**Element*/ popup) |
{ |
let window = popup.ownerDocument.defaultView; |
- if (!window.gContextMenuContentData || |
- typeof window.gContextMenuContentData.addonInfo != "object" || |
- typeof window.gContextMenuContentData.addonInfo.adblockplus != "object") |
+ let data = window.gContextMenuContentData; |
+ if (!data) |
{ |
- return; |
+ // This is SeaMonkey Mail or Thunderbird, they won't get context menu data |
+ // for us. Send the notification ourselves. |
+ let event = new Event("contextmenu"); |
tschuster
2015/12/02 12:14:17
Isn't event = {target: popup.triggernode} enough?
Wladimir Palant
2015/12/02 12:20:54
Fair enough, no point faking the notification prop
|
+ Object.defineProperty(event, "target", {"get": () => popup.triggerNode}); |
+ data = { |
+ event: event, |
+ addonInfo: {}, |
+ get wrappedJSObject() {return this;} |
+ }; |
+ Services.obs.notifyObservers(data, "AdblockPlus:content-contextmenu", null); |
} |
- let items = window.gContextMenuContentData.addonInfo.adblockplus; |
+ if (typeof data.addonInfo != "object" || typeof data.addonInfo.adblockplus != "object") |
+ return; |
+ |
+ let items = data.addonInfo.adblockplus; |
let clicked = null; |
let menuItems = []; |
function menuItemTriggered(id, nodeData) |
{ |
clicked = id; |
this.blockItem(window, id, nodeData); |
} |