Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/ui.js

Issue 29331700: Issue 3223 - Implement context menu fallback for SeaMonkey Mail and Thunderbird (Closed)
Patch Set: Don`t send real event, minimal object will do Created Dec. 2, 2015, 12:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/child/contextMenu.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -1595,24 +1595,33 @@ 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.
+ data = {
+ event: {target: popup.triggerNode},
+ 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);
}
« no previous file with comments | « lib/child/contextMenu.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld