Bug 223071 - Implement AbortSignal.abort()
Summary: Implement AbortSignal.abort()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Enhancement
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-11 08:14 PST by James M Snell
Modified: 2021-03-22 12:25 PDT (History)
14 users (show)

See Also:


Attachments
Patch (6.62 KB, patch)
2021-03-19 13:59 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (10.35 KB, patch)
2021-03-22 08:32 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James M Snell 2021-03-11 08:14:24 PST
https://github.com/whatwg/dom/pull/960 introduces a new utility `AbortSignal.abort()` that creates and returns an already aborted AbortSignal.

Example implementation in Node.js: https://github.com/nodejs/node/pull/37693. 

WPT Test: https://github.com/web-platform-tests/wpt/pull/28003
Comment 1 Radar WebKit Bug Importer 2021-03-18 09:15:15 PDT
<rdar://problem/75575483>
Comment 2 Chris Dumez 2021-03-19 13:59:21 PDT
Created attachment 423772 [details]
Patch
Comment 3 EWS Watchlist 2021-03-19 14:00:35 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 4 Darin Adler 2021-03-19 18:27:01 PDT
Comment on attachment 423772 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423772&action=review

> Source/WebCore/dom/AbortSignal.h:45
> +    static Ref<AbortSignal> createAborted(ScriptExecutionContext&);

Why not name this abort to match the DOM public API?
Comment 5 Chris Dumez 2021-03-19 18:28:27 PDT
Comment on attachment 423772 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423772&action=review

>> Source/WebCore/dom/AbortSignal.h:45
>> +    static Ref<AbortSignal> createAborted(ScriptExecutionContext&);
> 
> Why not name this abort to match the DOM public API?

Because the abort() name is very confusing for such operation. Also, AbortSignal already has an abort() member function to actually abort the signal. I wish the spec had called this aborted() instead of abort()..
Comment 6 Sam Weinig 2021-03-20 18:32:46 PDT
Comment on attachment 423772 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423772&action=review

>>> Source/WebCore/dom/AbortSignal.h:45
>>> +    static Ref<AbortSignal> createAborted(ScriptExecutionContext&);
>> 
>> Why not name this abort to match the DOM public API?
> 
> Because the abort() name is very confusing for such operation. Also, AbortSignal already has an abort() member function to actually abort the signal. I wish the spec had called this aborted() instead of abort()..

I think we should match the spec here and rename the other function to signalAbort, which is what the spec calls it. Even if we don’t love the names, it’s much easier if we match things when we can.
Comment 7 EWS 2021-03-22 05:00:30 PDT
commit-queue failed to commit attachment 423772 [details] to WebKit repository. To retry, please set cq+ flag again.
Comment 8 Chris Dumez 2021-03-22 08:22:57 PDT
(In reply to Sam Weinig from comment #6)
> Comment on attachment 423772 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=423772&action=review
> 
> >>> Source/WebCore/dom/AbortSignal.h:45
> >>> +    static Ref<AbortSignal> createAborted(ScriptExecutionContext&);
> >> 
> >> Why not name this abort to match the DOM public API?
> > 
> > Because the abort() name is very confusing for such operation. Also, AbortSignal already has an abort() member function to actually abort the signal. I wish the spec had called this aborted() instead of abort()..
> 
> I think we should match the spec here and rename the other function to
> signalAbort, which is what the spec calls it. Even if we don’t love the
> names, it’s much easier if we match things when we can.

Ok, will update the name.
Comment 9 Chris Dumez 2021-03-22 08:32:03 PDT
Created attachment 423885 [details]
Patch
Comment 10 EWS 2021-03-22 12:25:22 PDT
Committed r274773: <https://commits.webkit.org/r274773>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423885 [details].