[Extensions] Make it possible to export a custom object

Currently the JavaScript shim receives an "export" object which you are supposed to add properties. But what if you want to export an object created in the shim istead? This patch adds support for that: now, by returning an object, it gets exported at the root of the API namespace instead of the "export" object.

The reason why I'm adding this is because I'm going to need an EventTarget at the root of the Device Capabilties API.