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

Use an AbortController instead of signaling abort on AbortSignal #1279

Merged
merged 2 commits into from
May 31, 2023

Conversation

shaseley
Copy link
Contributor

@shaseley shaseley commented May 24, 2023

For whatwg/dom#1194 (and follow-up from #1277).

  • Replace WritableStreamDefaultController's [[signal]] with [[abortController]], using this abort controller's signal where [[signal]] was used. Signal abort on [[abortController]] rather than the [[signal]].
  • Remove the note/warning about specs not signaling abort on the WritableStream's signal, since this won't be allowed once AbortSignal's "signal abort" no longer exported.

Preview | Diff

 - Replace WritableStreamDefaultController's [[signal]] with
   [[AbortController]], using the controller's signal where [[signal]]
   was used. Signal abort on [[abortController]] rather than the
   [[signal]].
 - Remove the note about specs not signaling abort on the
   WritableStream's signal, since this won't be possible once
   AbortSignal's "signal abort" no longer exported.
@shaseley
Copy link
Contributor Author

@annevk how does this look?

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

If you replace the getter with the appropriate reference I think this works. Thanks!

@MattiasBuelens should do the final review though.

index.bs Outdated
@@ -4508,7 +4508,7 @@ closed. It is only used internally, and is never exposed to web developers.
The <dfn id="ws-default-controller-signal" attribute
for="WritableStreamDefaultController">signal</dfn> getter steps are:

1. Return [=this=].[=WritableStreamDefaultController/[[signal]]=].
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
Copy link
Member

Choose a reason for hiding this comment

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

You need to return the value of the "internal slot" and not reference the "public" getter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand Bikeshed's autolink syntax correctly, this should do the trick:

Suggested change
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].[=AbortController/signal=].

Copy link
Member

Choose a reason for hiding this comment

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

It'd have to be something like

Suggested change
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=]'s [=AbortController/signal=].

as we don't define dot syntax for these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay, makes sense. We'll need to export [=AbortController/signal=] for this to build/link, which I can do along with removing export from "signal abort".

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated
@@ -4508,7 +4508,7 @@ closed. It is only used internally, and is never exposed to web developers.
The <dfn id="ws-default-controller-signal" attribute
for="WritableStreamDefaultController">signal</dfn> getter steps are:

1. Return [=this=].[=WritableStreamDefaultController/[[signal]]=].
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand Bikeshed's autolink syntax correctly, this should do the trick:

Suggested change
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].[=AbortController/signal=].

Copy link
Contributor Author

@shaseley shaseley left a comment

Choose a reason for hiding this comment

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

Thanks for reviewing! I'll put together the dom changes this depends on.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated
@@ -4508,7 +4508,7 @@ closed. It is only used internally, and is never exposed to web developers.
The <dfn id="ws-default-controller-signal" attribute
for="WritableStreamDefaultController">signal</dfn> getter steps are:

1. Return [=this=].[=WritableStreamDefaultController/[[signal]]=].
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=].{{AbortController/signal}}.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay, makes sense. We'll need to export [=AbortController/signal=] for this to build/link, which I can do along with removing export from "signal abort".

index.bs Outdated Show resolved Hide resolved
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 once it builds.

@MattiasBuelens
Copy link
Collaborator

Latest build failure looks like a problem with Bikeshed itself. I've opened speced/bikeshed#2561.

@MattiasBuelens
Copy link
Collaborator

The new Bikeshed version fixes the build issue, so I think we're good to go! 🙂

@ricea ricea merged commit eba8c79 into whatwg:main May 31, 2023
aarongable pushed a commit to chromium/chromium that referenced this pull request May 31, 2023
Instead:
 - WritableStreamDefaultController has a AbortController
 - WritableStreamDefaultController::signal() returns the controller's
   signal
 - The signal is aborted via AbortController::abort()

Spec PR: whatwg/streams#1279

Bug: 1448352
Change-Id: I2abe12b9570b11de0767888a369316d3622c908d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4564333
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151315}
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.

4 participants