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

Unified Diff: lib/main.js

Issue 29363476: Issue 2879 - Move element selection into the content process (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Patch Set: Addressed comments and marked extension as E10S-compatible Created Nov. 24, 2016, 2 p.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/utils.js ('k') | lib/windowWrapper.js » ('j') | 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
@@ -22,17 +22,16 @@ let elementMarkerClass = null;
{
let rnd = [];
let offset = "a".charCodeAt(0);
for (let i = 0; i < 20; i++)
rnd.push(offset + Math.random() * 26);
elementMarkerClass = String.fromCharCode.apply(String, rnd);
}
-exports.elementMarkerClass = elementMarkerClass;
// Load CSS asynchronously
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
request.open("GET", "chrome://elemhidehelper/content/elementmarker.css");
request.overrideMimeType("text/plain");
request.addEventListener("load", function(event)
{
if (onShutdown.done)
@@ -43,16 +42,18 @@ request.addEventListener("load", functio
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 process script
let info = require("info");
+info.elementMarkerClass = elementMarkerClass;
+
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);
« no previous file with comments | « lib/child/utils.js ('k') | lib/windowWrapper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld