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