Index: lib/main.js |
=================================================================== |
--- a/lib/main.js |
+++ b/lib/main.js |
@@ -1,15 +1,15 @@ |
/* |
* This Source Code is subject to the terms of the Mozilla Public License |
* version 2.0 (the "License"). You can obtain a copy of the License at |
* http://mozilla.org/MPL/2.0/. |
*/ |
-Cu.import("resource://gre/modules/Services.jsm"); |
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
let {Prefs} = require("prefs"); |
let {WindowObserver} = require("windowObserver"); |
let {WindowWrapper} = require("windowWrapper"); |
// Check whether some preferences can still be found under their old locations |
Prefs.migrate("extensions.adblockplus.ehh-selectelement_key", "selectelement_key"); |
Prefs.migrate("extensions.adblockplus.ehh.showhelp", "showhelp"); |
@@ -41,16 +41,24 @@ request.addEventListener("load", functio |
let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass); |
let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); |
let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null); |
styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET); |
onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET)); |
}, false); |
request.send(null); |
+// Load our developer tools actor |
+let frameScript = "chrome://elemhidehelper/content/frameScript.js?" + elementMarkerClass; |
+Services.mm.loadFrameScript(frameScript, true); |
+onShutdown.add(() => { |
+ Services.mm.removeDelayedFrameScript(frameScript); |
+ Services.mm.broadcastAsyncMessage("ElemHideHelper:Shutdown"); |
+}); |
+ |
// Load overlay asynchonously and start attaching to windows once done |
request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSXMLHttpRequest); |
request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); |
request.addEventListener("load", function(event) |
{ |
if (onShutdown.done) |
return; |