diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-12-11 18:13:17 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-12-11 18:13:17 -0500 |
commit | e437d1f8c8595a5177333837cce5fdfd132779d9 (patch) | |
tree | eb3e6d440b601a98e738697aa087a70a0be3677b | |
parent | da2ffd1445f4dd8cddad031f2a192c7e778b9900 (diff) | |
download | eib-e437d1f8c8595a5177333837cce5fdfd132779d9.tar.xz eib-e437d1f8c8595a5177333837cce5fdfd132779d9.zip |
-rw-r--r-- | src/bootstrap.js | 21 |
1 files 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); } |