[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
instead? This patch adds support for that: now, by assigning it to an object,
the object gets exported at the root of the API namespace instead of the
"export" object.
[Extensions] Add tests for exporting objects in the JavaScript shim

The test verifies if both methods of exporting objects (hanging properties
on the "export" object or assigning it to another object) are working fine.