OLD | NEW |
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 let {Services} = 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"); |
(...skipping 29 matching lines...) Expand all Loading... |
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 | 48 |
49 // Load our developer tools actor | 49 // Load our developer tools actor |
50 let frameScript = "chrome://elemhidehelper/content/frameScript.js?" + elementMar
kerClass; | 50 let processScript = "chrome://elemhidehelper/content/processScript.js?" + elemen
tMarkerClass; |
51 let messageManager = Cc["@mozilla.org/globalmessagemanager;1"] | 51 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
52 .getService(Ci.nsIFrameScriptLoader); | 52 .getService(Ci.nsIProcessScriptLoader); |
53 messageManager.loadFrameScript(frameScript, true); | 53 messageManager.loadProcessScript(processScript, true); |
54 onShutdown.add(() => { | 54 onShutdown.add(() => { |
55 messageManager.removeDelayedFrameScript(frameScript); | 55 messageManager.removeDelayedProcessScript(processScript); |
56 messageManager.QueryInterface(Ci.nsIMessageBroadcaster).broadcastAsyncMessage(
"ElemHideHelper:Shutdown"); | 56 messageManager.QueryInterface(Ci.nsIMessageBroadcaster).broadcastAsyncMessage(
"ElemHideHelper:Shutdown"); |
57 }); | 57 }); |
58 | 58 |
59 // Load overlay asynchonously and start attaching to windows once done | 59 // Load overlay asynchonously and start attaching to windows once done |
60 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX
MLHttpRequest); | 60 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX
MLHttpRequest); |
61 request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); | 61 request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); |
62 request.channel.owner = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPr
incipal); | 62 request.channel.owner = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPr
incipal); |
63 request.addEventListener("load", function(event) | 63 request.addEventListener("load", function(event) |
64 { | 64 { |
65 if (onShutdown.done) | 65 if (onShutdown.done) |
(...skipping 30 matching lines...) Expand all Loading... |
96 if (element) | 96 if (element) |
97 element.parentNode.removeChild(element); | 97 element.parentNode.removeChild(element); |
98 | 98 |
99 for (let child = window.document.firstChild; child; child = child.nextSibl
ing) | 99 for (let child = window.document.firstChild; child; child = child.nextSibl
ing) |
100 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in
dexOf("elemhidehelper-node") >= 0) | 100 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in
dexOf("elemhidehelper-node") >= 0) |
101 child.parentNode.removeChild(child); | 101 child.parentNode.removeChild(child); |
102 } | 102 } |
103 }); | 103 }); |
104 }, false); | 104 }, false); |
105 request.send(null); | 105 request.send(null); |
OLD | NEW |