LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | 20 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
21 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); | 21 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); |
22 | 22 |
23 let {Utils} = require("utils"); | 23 let {Utils} = require("utils"); |
24 let {RequestNotifier} = require("child/requestNotifier"); | 24 let {RequestNotifier} = require("child/requestNotifier"); |
25 let {storeNodes} = require("child/contentPolicy"); | 25 let {storeNodes} = require("child/contentPolicy"); |
26 | 26 |
27 let getContextInfo = | |
28 /** | 27 /** |
29 * Determines the context menu entries to be shown for a contextmenu event. | 28 * Determines the context menu entries to be shown for a contextmenu event. |
30 * @param {Event} event | 29 * @param {Event} event |
31 * @return {Array} | 30 * @return {Array} |
32 */ | 31 */ |
33 exports.getContextInfo = function(event) | 32 function getContextInfo(event) |
34 { | 33 { |
35 let items = []; | 34 let items = []; |
36 let target = event.target; | 35 let target = event.target; |
37 if (target.localName == "menupopup" && target.triggerNode) | 36 if (target.localName == "menupopup" && target.triggerNode) |
38 { | 37 { |
39 // SeaMonkey gives us the context menu's popupshowing event | 38 // SeaMonkey gives us the context menu's popupshowing event |
40 target = target.triggerNode; | 39 target = target.triggerNode; |
41 } | 40 } |
42 if (target instanceof Ci.nsIDOMHTMLMapElement || target instanceof Ci.nsIDOMHT
MLAreaElement) | 41 if (target instanceof Ci.nsIDOMHTMLMapElement || target instanceof Ci.nsIDOMHT
MLAreaElement) |
43 { | 42 { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 }, | 131 }, |
133 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 132 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
134 }; | 133 }; |
135 | 134 |
136 let addObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "addObserver
"); | 135 let addObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "addObserver
"); |
137 addObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu", true)
; | 136 addObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu", true)
; |
138 onShutdown.add(() => { | 137 onShutdown.add(() => { |
139 let removeObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "remove
Observer"); | 138 let removeObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "remove
Observer"); |
140 removeObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu"); | 139 removeObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu"); |
141 }); | 140 }); |
LEFT | RIGHT |