Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/main.js

Issue 29362609: Issue 2879 - Restructure existing process script, split it up into multiple modules (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Patch Set: Fixed line length Created Dec. 1, 2016, 9:39 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/child/preview.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/main.js
===================================================================
--- a/lib/main.js
+++ b/lib/main.js
@@ -41,24 +41,28 @@ 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 processScript = "chrome://elemhidehelper/content/processScript.js?" + elementMarkerClass;
+// Load our process script
+let info = require("info");
+let processScript = info.addonRoot + "lib/child/bootstrap.js?" +
+ elementMarkerClass + "&" +
+ "info=" + encodeURIComponent(JSON.stringify(info));
let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIProcessScriptLoader);
messageManager.loadProcessScript(processScript, true);
onShutdown.add(() => {
messageManager.removeDelayedProcessScript(processScript);
- messageManager.QueryInterface(Ci.nsIMessageBroadcaster).broadcastAsyncMessage("ElemHideHelper:Shutdown");
+ messageManager.QueryInterface(Ci.nsIMessageBroadcaster)
+ .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.channel.owner = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrincipal);
request.addEventListener("load", function(event)
{
« no previous file with comments | « lib/child/preview.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld