OLD | NEW |
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 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 return items; | 116 return items; |
117 }; | 117 }; |
118 | 118 |
119 let ContextMenuObserver = | 119 let ContextMenuObserver = |
120 { | 120 { |
121 observe: function(subject, topic, data) | 121 observe: function(subject, topic, data) |
122 { | 122 { |
123 if (topic == "content-contextmenu") | 123 if (subject.wrappedJSObject) |
124 { | 124 subject = subject.wrappedJSObject; |
125 if (subject.wrappedJSObject) | |
126 subject = subject.wrappedJSObject; | |
127 | 125 |
128 if (subject.addonInfo) | 126 if (subject.addonInfo) |
129 subject.addonInfo.adblockplus = getContextInfo(subject.event); | 127 subject.addonInfo.adblockplus = getContextInfo(subject.event); |
130 } | |
131 }, | 128 }, |
132 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 129 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
133 }; | 130 }; |
134 | 131 |
135 let addObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "addObserver
"); | 132 let addObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "addObserver
"); |
136 addObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu", true)
; | 133 addObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu", true)
; |
| 134 addObserver.call(Services.obs, ContextMenuObserver, "AdblockPlus:content-context
menu", true); |
137 onShutdown.add(() => { | 135 onShutdown.add(() => { |
138 let removeObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "remove
Observer"); | 136 let removeObserver = Utils.getPropertyWithoutCompatShims(Services.obs, "remove
Observer"); |
139 removeObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu"); | 137 removeObserver.call(Services.obs, ContextMenuObserver, "content-contextmenu"); |
| 138 removeObserver.call(Services.obs, ContextMenuObserver, "AdblockPlus:content-co
ntextmenu"); |
140 }); | 139 }); |
OLD | NEW |