Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReadableStream constructor if not getting a promise as startResult #250

Closed
wants to merge 1 commit into from

Conversation

calvaris
Copy link
Contributor

@calvaris calvaris commented Dec 8, 2014

In the examples we have cases where the result of invoking the start
is undefined and we treat it as something acceptable, therefore the
constructor should be prepared to operate in that case.

I guess this should also apply to other cases, like the WritableStream constructor, cancel functions, etc.

In the examples we have cases where the result of invoking the start
is undefined and we treat it as something acceptable, therefore the
constructor should be prepared to operate in that case.
@domenic
Copy link
Member

domenic commented Dec 8, 2014

The next line resolves startResult as a promise, so this is not correct.

@domenic domenic closed this Dec 8, 2014
@calvaris
Copy link
Contributor Author

calvaris commented Dec 9, 2014

Hi Domenic,

I acknowledge that we forgot to add the code to set this@[[started]] to true.

The problem is other though. As I explained, in the shown examples, sometimes a promise is not returned or resolved, sometimes, even nothing is returned (which means startResult becomes undefined). The question is for those cases, how will the current algorithm behave?

We considered that if startResult is undefined, we should proceed to fulfillment and that's why we went to pull, though I already acknowledged that we forgot about the [[started]]

@domenic
Copy link
Member

domenic commented Dec 9, 2014

No, you're missing what I said. The next line contains

Resolve startResult as a promise:

so in the case of startResult undefined, the promise that we're doing "on fulfillment"/"on rejection" on will be equivalent to Promise.resolve(undefined).

@calvaris
Copy link
Contributor Author

The thing is that I tried to find in the Promises spec is what happens when undefined is returned as a promise, but if you say it is like that then it makes sense. Thanks!

@calvaris calvaris deleted the constructor branch January 28, 2015 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants