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