Skip to content

Conversation

yutakahirano
Copy link
Member

@yutakahirano yutakahirano commented Nov 7, 2019

We have used an imprecise sentence for creating a ReadableStream "from which
one can read the exactly same data as one could read" from the original
ReadableStream, because transform streams and piping were not defined. Now they
are available, so let's use them.

Fixes #463.


Preview | Diff

@yutakahirano yutakahirano force-pushed the yhirano/request-transform-pipeto branch from 5741a2c to 2cd96ec Compare November 7, 2019 06:06
@yutakahirano
Copy link
Member Author

@annevk @ricea can you PTAL?

@yutakahirano yutakahirano requested review from annevk and ricea November 7, 2019 06:10
ricea added a commit to ricea/streams that referenced this pull request Nov 7, 2019
Set the [[disturbed]] internal slot to true in ReadableStreamPipeTo.
This is useful for the Fetch Standard. It is not visible to user code.

See whatwg/fetch#959 for the Fetch Standard
change that requires this.
Copy link
Collaborator

@ricea ricea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

<a for=ReadableStream>locked</a> and <a for=ReadableStream>disturbed</a> immediately.
</li>

<li><p>Set <var>promise</var>.\[[PromiseIsHandled]]</var> to true.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid this? Manipulating internal state of promises seems problematic and especially doing so in a specification that isn't likely to be notified if ECMAScript is refactored in some fashion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of one other than calling then (or catch) explicitly. @domenic, do you have any recommendation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion this is an exceptional internal slot that it is OK for other standards to manipulate. (As an alternative to uselessly calling PerformPromiseThen() with a no-op catch handler.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of moving this into IDL somehow with other specifications having "Handle promise." or some such?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a reasonable future cleanup, yeah. As-is right now we're still in the world where streams operates on ES promises directly.

ricea added a commit to whatwg/streams that referenced this pull request Nov 13, 2019
Set the [[disturbed]] internal slot to true in ReadableStreamPipeTo.
This is useful for the Fetch Standard.

See whatwg/fetch#959 for the Fetch Standard
change that requires this.
@annevk
Copy link
Member

annevk commented Dec 11, 2019

Remaining:

  • Domenic's cross-reference issue.
  • Follow-up issues against IDL and specifications manipulating Promise internals.
  • Tests? Not sure if this is observable or not.

We have used an imprecise sentence for creating a ReadableStream "from which
one can read the exactly same data as one could read" from the original
ReadableStream, because transform streams and piping were not defined. Now they
are available, so let's use them.

Fixes #463.
@yutakahirano yutakahirano force-pushed the yhirano/request-transform-pipeto branch from 4d4f0b9 to 81c5b23 Compare December 13, 2019 09:02
@yutakahirano
Copy link
Member Author

yutakahirano commented Dec 13, 2019

Domenic's cross-reference issue.

Done.

Follow-up issues against IDL and specifications manipulating Promise internals.

Filed whatwg/webidl/issues/829.

Tests? Not sure if this is observable or not.

I think we don't need tests. This is a kind of cleanup change.

@annevk annevk merged commit c1b367d into master Dec 13, 2019
@annevk annevk deleted the yhirano/request-transform-pipeto branch December 13, 2019 11:00
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.

Specify body transfer in Request constructor more precisely

4 participants