commit 2c4dd9e4bec9a24e674fdcdbf0fba6be3dab3c03 Author: David Fifield david@bamsoftware.com Date: Sun Mar 23 19:46:15 2014 -0700
Block without returning in profile-after-change handler.
As suggested in https://trac.torproject.org/projects/tor/ticket/11183#comment:11, I'm going to try running the HTTP helper in a second browser instance. The extension blocks in order that the browser won't show a browser window.
There's probably a better way to block the function without returning, but for now I'm just raising a modal dialog. --- firefox/components/main.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/firefox/components/main.js b/firefox/components/main.js index d4b4d35..8ed3fd1 100644 --- a/firefox/components/main.js +++ b/firefox/components/main.js @@ -55,11 +55,23 @@ MeekHTTPHelper.prototype = { if (topic !== "profile-after-change") return
- // https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIServer... - var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"] - .createInstance(Components.interfaces.nsIServerSocket); - serverSocket.init(MeekHTTPHelper.LOCAL_PORT, true, -1); - serverSocket.asyncListen(this); + try { + // https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIServer... + var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"] + .createInstance(Components.interfaces.nsIServerSocket); + // Listen on loopback only, with default backlog. + serverSocket.init(MeekHTTPHelper.LOCAL_PORT, true, -1); + serverSocket.asyncListen(this); + + // Block forever. + var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + prompts.confirm(null, "Query", "Get down, get funky?"); + } finally { + var app = Components.classes["@mozilla.org/toolkit/app-startup;1"] + .getService(Components.interfaces.nsIAppStartup); + app.quit(app.eForceQuit); + } },
// nsIServerSocketListener implementation.
tor-commits@lists.torproject.org