LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 Cu.import("resource://gre/modules/Services.jsm"); | 7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
8 | 8 |
9 let {Prefs} = require("prefs"); | 9 let {Prefs} = require("prefs"); |
10 let {WindowObserver} = require("windowObserver"); | 10 let {WindowObserver} = require("windowObserver"); |
11 let {WindowWrapper} = require("windowWrapper"); | 11 let {WindowWrapper} = require("windowWrapper"); |
12 | 12 |
13 // Check whether some preferences can still be found under their old locations | 13 // Check whether some preferences can still be found under their old locations |
14 Prefs.migrate("extensions.adblockplus.ehh-selectelement_key", "selectelement_key
"); | 14 Prefs.migrate("extensions.adblockplus.ehh-selectelement_key", "selectelement_key
"); |
15 Prefs.migrate("extensions.adblockplus.ehh.showhelp", "showhelp"); | 15 Prefs.migrate("extensions.adblockplus.ehh.showhelp", "showhelp"); |
16 | 16 |
17 // Window types to attach to | 17 // Window types to attach to |
(...skipping 20 matching lines...) Expand all Loading... |
38 if (onShutdown.done) | 38 if (onShutdown.done) |
39 return; | 39 return; |
40 | 40 |
41 let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass)
; | 41 let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass)
; |
42 let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService
(Ci.nsIStyleSheetService); | 42 let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService
(Ci.nsIStyleSheetService); |
43 let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data),
null, null); | 43 let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data),
null, null); |
44 styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET
); | 44 styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET
); |
45 onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetSe
rvice.USER_SHEET)); | 45 onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetSe
rvice.USER_SHEET)); |
46 }, false); | 46 }, false); |
47 request.send(null); | 47 request.send(null); |
| 48 |
| 49 // Load our developer tools actor |
| 50 let frameScript = "chrome://elemhidehelper/content/frameScript.js?" + elementMar
kerClass; |
| 51 Services.mm.loadFrameScript(frameScript, true); |
| 52 onShutdown.add(() => { |
| 53 Services.mm.removeDelayedFrameScript(frameScript); |
| 54 Services.mm.broadcastAsyncMessage("ElemHideHelper:Shutdown"); |
| 55 }); |
48 | 56 |
49 // Load overlay asynchonously and start attaching to windows once done | 57 // Load overlay asynchonously and start attaching to windows once done |
50 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX
MLHttpRequest); | 58 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX
MLHttpRequest); |
51 request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); | 59 request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); |
52 request.addEventListener("load", function(event) | 60 request.addEventListener("load", function(event) |
53 { | 61 { |
54 if (onShutdown.done) | 62 if (onShutdown.done) |
55 return; | 63 return; |
56 | 64 |
57 let overlay = event.target.responseXML.documentElement; | 65 let overlay = event.target.responseXML.documentElement; |
(...skipping 27 matching lines...) Expand all Loading... |
85 if (element) | 93 if (element) |
86 element.parentNode.removeChild(element); | 94 element.parentNode.removeChild(element); |
87 | 95 |
88 for (let child = window.document.firstChild; child; child = child.nextSibl
ing) | 96 for (let child = window.document.firstChild; child; child = child.nextSibl
ing) |
89 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in
dexOf("elemhidehelper-node") >= 0) | 97 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in
dexOf("elemhidehelper-node") >= 0) |
90 child.parentNode.removeChild(child); | 98 child.parentNode.removeChild(child); |
91 } | 99 } |
92 }); | 100 }); |
93 }, false); | 101 }, false); |
94 request.send(null); | 102 request.send(null); |
LEFT | RIGHT |