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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 /** | 72 /** |
73 * Called on module startup, initializes various exported properties. | 73 * Called on module startup, initializes various exported properties. |
74 */ | 74 */ |
75 init: function() | 75 init: function() |
76 { | 76 { |
77 // whitelisted URL schemes | 77 // whitelisted URL schemes |
78 for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" ")) | 78 for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" ")) |
79 this.whitelistSchemes.add(scheme); | 79 this.whitelistSchemes.add(scheme); |
80 | 80 |
81 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] | 81 Utils.addChildMessageListener("AdblockPlus:ShouldAllow", this.shouldAllow.bi
nd(this)); |
82 .getService(Ci.nsIMessageListenerManager) | 82 Utils.addChildMessageListener("AdblockPlus:GetCollapsedClass", () => collaps
edClass); |
83 .QueryInterface(Ci.nsIMessageBroadcaster); | |
84 let handler = (message => this.shouldAllow(message.data)); | |
85 messageManager.addMessageListener("AdblockPlus:ShouldAllow", handler); | |
86 onShutdown.add(() => messageManager.removeMessageListener("AdblockPlus:Shoul
dAllow", handler)); | |
87 | |
88 let handler2 = () => collapsedClass; | |
89 messageManager.addMessageListener("AdblockPlus:GetCollapsedClass", handler2)
; | |
90 onShutdown.add(() => messageManager.removeMessageListener("AdblockPlus:GetCo
llapsedClass", handler2)); | |
91 | 83 |
92 // Generate class identifier used to collapse node and register correspondin
g | 84 // Generate class identifier used to collapse node and register correspondin
g |
93 // stylesheet. | 85 // stylesheet. |
94 let offset = "a".charCodeAt(0); | 86 let offset = "a".charCodeAt(0); |
95 for (let i = 0; i < 20; i++) | 87 for (let i = 0; i < 20; i++) |
96 collapsedClass += String.fromCharCode(offset + Math.random() * 26); | 88 collapsedClass += String.fromCharCode(offset + Math.random() * 26); |
97 | 89 |
98 let collapseStyle = Services.io.newURI("data:text/css," + | 90 let collapseStyle = Services.io.newURI("data:text/css," + |
99 encodeURIComponent("." + collapsedClass + | 91 encodeURIComponent("." + collapsedClass + |
100 "{-moz-binding: url(chrome://global/content/bindings/general.xml#foobarb
azdummy) !important;}"), null, null); | 92 "{-moz-binding: url(chrome://global/content/bindings/general.xml#foobarb
azdummy) !important;}"), null, null); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (!wnd || wnd.closed) | 404 if (!wnd || wnd.closed) |
413 return; | 405 return; |
414 | 406 |
415 if (entry.type == "OBJECT") | 407 if (entry.type == "OBJECT") |
416 { | 408 { |
417 node.removeEventListener("mouseover", objectMouseEventHander, true); | 409 node.removeEventListener("mouseover", objectMouseEventHander, true); |
418 node.removeEventListener("mouseout", objectMouseEventHander, true); | 410 node.removeEventListener("mouseout", objectMouseEventHander, true); |
419 } | 411 } |
420 Policy.processNode(wnd, node, entry.type, entry.location, true); | 412 Policy.processNode(wnd, node, entry.type, entry.location, true); |
421 } | 413 } |
OLD | NEW |