From e437d1f8c8595a5177333837cce5fdfd132779d9 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Thu, 11 Dec 2014 18:13:17 -0500 Subject: General code cleanup. --- src/bootstrap.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/bootstrap.js b/src/bootstrap.js index 0fbc56e..c49e1ca 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -4,10 +4,8 @@ if (typeof EIB === "undefined") pending: [] }; -const Cc = Components.classes, Ci = Components.interfaces, Cu = Components.utils, CC = Components.Constructor, Cr = Components.results; +const Cc = Components.classes, Ci = Components.interfaces, Cu = Components.utils, CC = Components.Constructor; const ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream", "init"); -const FileInputStream = CC("@mozilla.org/network/file-input-stream;1", "nsIFileInputStream", "init"); -const LocalFileFromPath = CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath"); Cu.import("resource://gre/modules/Services.jsm"); @@ -26,7 +24,7 @@ var ServerListener = { buf += sis.read(2048); if (buf.indexOf("\r\n\r\n") > -1) { - is.close(); + sis.close(); // parse out headers var headers = {}; @@ -84,7 +82,7 @@ var ServerListener = { EIB.listen = function () { this.serverSocket = Cc["@mozilla.org/network/server-socket;1"] - .createInstance(Ci.nsIServerSocket); + .createInstance(Ci.nsIServerSocket); this.serverSocket.init(26001, true, -1); this.serverSocket.asyncListen(ServerListener); }; @@ -109,17 +107,14 @@ function forEachOpenWindow(todo) { } var WindowListener = { - onOpenWindow: function(xulWindow) - { + onOpenWindow: function(xulWindow) { var window = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindow); - function onWindowLoad() - { + window.addEventListener("load", function onWindowLoad() { window.removeEventListener("load", onWindowLoad); if (window.document.documentElement.getAttribute("windowtype") == "navigator:browser") loadIntoWindow(window); - } - window.addEventListener("load", onWindowLoad); + }); }, }; @@ -197,9 +192,9 @@ function injectCCPEVE(e) { } function loadIntoWindow(window) { - window.document.getElementById("appcontent").addEventListener("DOMContentLoaded", injectCCPEVE, false); + window.document.getElementById("appcontent").addEventListener("DOMContentLoaded", injectCCPEVE); } function unloadFromWindow(window) { - window.document.getElementById("appcontent").removeEventListener("DOMContentLoaded", injectCCPEVE, false); + window.document.getElementById("appcontent").removeEventListener("DOMContentLoaded", injectCCPEVE); } -- cgit v1.2.3-54-g00ecf