Add functionality to StreamThenPromise()

ReadableStreamNative needs some extra functionality from

* Support the single argument form of Then(). The |on_rejected| argument
  is now optional.
* Behave as Catch() by setting the |on_fulfilled| argument to nullptr.
* Return the return value from Then() instead of void. Only a Promise
  resolving to undefined can be created due to the StreamScriptFunction
  API having no provision for a return value, but this is sufficient to
  implement ReadableStream.


Change-Id: I44f0ba0109568c8fd09882e2f1f05ba50816364a
Reviewed-by: Yutaka Hirano <>
Commit-Queue: Adam Rice <>
Cr-Commit-Position: refs/heads/master@{#641440}
2 files changed