Allow promise returns

This adds the functionality to allow calls to return Promises (`$.Deferred`, etc.) and return the result to the source frame.

cc @fleon