Gozala/volcan — pull request #1 by Gozala (2014-05-06 19:02:33+00:00)
Title: Bug 983928 - Make protocol.js usable from content privileged code

So this is my attempt to extract client stuff from the protocol.js so that it does not depend on server being available in the same JS context. This constraint imposed some limitations, like custom lifetime management is not taken into account, which I hope we will be able to fix with either changes to protocol or the additions to protocol description we generate.

Note that implementation can run both on node and in browser context, for node there is special Port module that implements MessageChannel's MessagePort interface and represents connection to debugger server, in case of add-on's actual MessagePort instance is available in the toolbar panel context. Also note that version bundled with sdk is generated with browserify, which means that some modules like `event.js` for example are overidden with equivalents like `browser/event.js` you can see those overrides in the package.json.

You may also notice that it's not just copy & paste from protocol.js since later had some implicit dependencies on server component and there were things that were not clear for me when digging into, so there are little bit of trying to make things clear style changes along. I'd say this implementation is a lot closer to your python version as it has same constraints and is little more clear given that implementation is little more recent.