nickdesaulniers / fxos-irc

IRC client for FxOS (and now desktop FF)
GNU General Public License v3.0
38 stars 13 forks source link

Firesea IRC

Notes

Running in Desktop Firefox

  1. Turn on mozTCPSocket pref
  2. Add tcp-socket permission for a domain
    • Hosting it locally
  3. Run

Idea from @asutherland

1. Turn on mozTCPSocket pref

Add tcp-socket permission for a domain (locally)

So you could run this from github pages, or from your local machine. Hosting it locally is a better idea, because theoritically Github could serve you different assets that abuse the ability to create TCP sockets. Far-fetched but possible.

I'd recommend (this part optional, but recommended) that you add a domain to your hosts file that redirects back to your machine, that way you're not allowing any site on localhost to use TCP sockets. I added the following to the bottom of my /etc/hosts file:

127.0.0.1 firesea.mozilla.org

For whichever method you choose (locally or gh-pages), you need to add a permission for it. If you are hosting it locally, you would:

Bring up the error console in firefox by hitting control-shift-J. Paste the code into the "Code" box and click the "evaluate" button.

host = 'http://firesea.mozilla.org:8000';
perm = Components.classes["@mozilla.org/permissionmanager;1"]
                 .createInstance(Components.interfaces.nsIPermissionManager);
ios = Components.classes["@mozilla.org/network/io-service;1"]
                .getService(Components.interfaces.nsIIOService);
uri = ios.newURI(host, null, null);
perm.add(uri, 'tcp-socket', 1);

This will allow http://firesea.mozilla.org:8000 permission to create and use TCP sockets. Tailor as needed.

XXX: TODO find out how to remove permission since it's not in about:permissions

Run

I serve this locally with the command python -m SimpleHTTPServer. I should host the assets somewhere so you don't have to host them yourself, and create an add-on to add the pref and permission, but I haven't yet. I don't know when TCPSockets will land in desktop FF pref'd off.

Once serving, go to http://firesea.mozilla.org:8000 and enjoy.