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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 * Checks whether the page loaded in a window is whitelisted for indication in
the UI. | 255 * Checks whether the page loaded in a window is whitelisted for indication in
the UI. |
256 * @param wnd {nsIDOMWindow} | 256 * @param wnd {nsIDOMWindow} |
257 * @return {Filter} matching exception rule or null if not whitelisted | 257 * @return {Filter} matching exception rule or null if not whitelisted |
258 */ | 258 */ |
259 isWindowWhitelisted: function(wnd) | 259 isWindowWhitelisted: function(wnd) |
260 { | 260 { |
261 return this.isWhitelisted(getWindowLocation(wnd)); | 261 return this.isWhitelisted(getWindowLocation(wnd)); |
262 }, | 262 }, |
263 | 263 |
264 /** | 264 /** |
265 * Asynchronously re-checks filters for given nodes. | 265 * Deletes nodes that were previously stored with a |
266 * @param {Node[]} nodes | 266 * RequestNotifier.storeNodesForEntries() call or similar. |
| 267 * @param {string} id unique ID of the nodes |
| 268 */ |
| 269 deleteNodes: function(id) |
| 270 { |
| 271 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
| 272 .getService(Ci.nsIMessageBroadcaster); |
| 273 messageManager.broadcastAsyncMessage("AdblockPlus:DeleteNodes", id); |
| 274 }, |
| 275 |
| 276 /** |
| 277 * Asynchronously re-checks filters for nodes given by an ID previously |
| 278 * returned by a RequestNotifier.storeNodesForEntries() call or similar. |
| 279 * @param {string} id unique ID of the nodes |
267 * @param {RequestEntry} entry | 280 * @param {RequestEntry} entry |
268 */ | 281 */ |
269 refilterNodes: function(nodes, entry) | 282 refilterNodes: function(id, entry) |
270 { | 283 { |
271 // Ignore nodes that have been blocked already | 284 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
272 if (entry.filter && !(entry.filter instanceof WhitelistFilter)) | 285 .getService(Ci.nsIMessageBroadcaster); |
273 return; | 286 messageManager.broadcastAsyncMessage("AdblockPlus:RefilterNodes", { |
274 | 287 nodesID: id, |
275 for (let node of nodes) | 288 entry: entry |
276 Utils.runAsync(() => refilterNode(node, entry)); | 289 }); |
277 } | 290 } |
278 }; | 291 }; |
279 Policy.init(); | 292 Policy.init(); |
280 | 293 |
281 /** | 294 /** |
282 * Extracts the hostname from a URL (might return null). | 295 * Extracts the hostname from a URL (might return null). |
283 */ | 296 */ |
284 function getHostname(/**String*/ url) /**String*/ | 297 function getHostname(/**String*/ url) /**String*/ |
285 { | 298 { |
286 try | 299 try |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 { | 395 { |
383 // EffectiveTLDService throws on IP addresses, just compare the host name | 396 // EffectiveTLDService throws on IP addresses, just compare the host name |
384 let host = ""; | 397 let host = ""; |
385 try | 398 try |
386 { | 399 { |
387 host = uri.host; | 400 host = uri.host; |
388 } catch (e) {} | 401 } catch (e) {} |
389 return host != docDomain; | 402 return host != docDomain; |
390 } | 403 } |
391 } | 404 } |
392 | |
393 /** | |
394 * Re-checks filters on an element. | |
395 */ | |
396 function refilterNode(/**Node*/ node, /**RequestEntry*/ entry) | |
397 { | |
398 let wnd = Utils.getWindow(node); | |
399 if (!wnd || wnd.closed) | |
400 return; | |
401 | |
402 if (entry.type == "OBJECT") | |
403 { | |
404 node.removeEventListener("mouseover", objectMouseEventHander, true); | |
405 node.removeEventListener("mouseout", objectMouseEventHander, true); | |
406 } | |
407 Policy.processNode(wnd, node, entry.type, entry.location, true); | |
408 } | |
OLD | NEW |