-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[v14.x] Backport AbortController and friends #38386
[v14.x] Backport AbortController and friends #38386
Conversation
/cc @jasnell @benjamingr |
I did not include commits adding abort support to |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds two globals in a non-semver-major fashion.
I am LGTMing the actual backport - but please be very careful with the implications for users.
For example:
- A user is using an abortcontroller polyfill that implements the interface in a non whatwg spec compliant way.
- We backport AbortController as a global
- The polyfill now sees the global so it doesn't polyfill
- The user relying on the non-spec-compliant behaviour (like AbortSignal being an EventEmitter) has code breakage because of a minor version Node.js update
I am not sure how common or realistic the above is.
@benjamingr This doesn't backport the global by default (it stays behind the |
Ok, I thought that was "coming", if this stays behind a flag and is only global in our eslint config etc then LGTM |
@targos do you want more reviewers given the number of commits, or should I go ahead and backport this? |
I'd love to have some more eyes on this as it's not a trivial backport. Let's keep it open 24 more hours. |
d0c99b1
to
a4045c8
Compare
Fwiw I actually went through the changes here and they look fine - not a rubberstamp lgtm :) |
I'm starting to think that this somehow breaks |
AbortController impl based very closely on: https://github.com/mysticatea/abort-controller Marked experimental. Not currently used by any of the existing promise apis. Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33527 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
After successful timer finish the abort event callback would still reject (already resolved promise) upon calling abortController.abort(). Signed-off-by: Denys Otrishko <[email protected]> PR-URL: nodejs#33949 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Move the promisified timers implementations into a new internal. submodule. Also adds `ref` option to the promisified versions. Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33950 Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
On the web, `AbortError` is the error name, not the error message. Change the code to match that. PR-URL: nodejs#34763 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Allows an AbortSignal to be passed in to events.once() to cancel waiting on an event. Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#34911 Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#34912 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
Add a line to the example code to clarify what happens if an event is emitted after listening is canceled. Make minor revisions to surrounding text. PR-URL: nodejs#35005 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
The AbortController abort event should have EventTarget as a target property of the argument event. PR-URL: #35869 Backport-PR-URL: #38386 Refs: https://github.com/web-platform-tests/wpt/blob/master/dom/abort/event.any.js Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Refs: web-platform-tests/wpt#9361 PR-URL: #35869 Backport-PR-URL: #38386 Refs: https://github.com/web-platform-tests/wpt/blob/master/dom/abort/event.any.js Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #35911 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
PR-URL: #35993 Backport-PR-URL: #38386 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #35806 Backport-PR-URL: #38386 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #35851 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Ricky Zhou <[email protected]>
PR-URL: #35931 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #35931 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #35931 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #35931 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Fixes: #36064 PR-URL: #36094 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Andrey Pechkurov <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #35991 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #36048 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Add support - Add test - Docs once PR is up PR-URL: #36070 Backport-PR-URL: #38386 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #36308 Backport-PR-URL: #38386 Reviewed-By: Rich Trott <[email protected]>
Verify that if something different than Abortcontroller.signal is passed to child_process.execFile(), ERR_INVALID_ARG_TYPE is thrown. PR-URL: #36429 Backport-PR-URL: #38386 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]>
I was working on AbortSignal for spawn and noticed there is a leak in the current code for AbortSignal support in child_process since it removes the wrong listener. I used the new signal as argument feature to make removing the listener easier and added a test. PR-URL: #36424 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #36432 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #36603 Backport-PR-URL: #38386 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #36604 Backport-PR-URL: #38386 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Richard Lau <[email protected]>
PR-URL: #37026 Backport-PR-URL: #38386 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37190 Backport-PR-URL: #38386 Refs: #37179 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fix an issue in writeFile where a file is opened, and not closed if the abort signal is aborted after the file was opened but before writing began. PR-URL: #37393 Backport-PR-URL: #38386 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: #37714 Backport-PR-URL: #38386 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: #36001 Backport-PR-URL: #38386 Fixes: #35990 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #36115 Backport-PR-URL: #38386 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: whatwg/dom#960 PR-URL: #37693 Backport-PR-URL: #38386 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: #37693 Backport-PR-URL: #38386 Refs: whatwg/dom#960 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #37720 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
The test uses a file name twice, causing unreliability in CI. In particular, it's failing a lot on the Raspberry Pi devices. Fixes: #36090 PR-URL: #36102 Backport-PR-URL: #38386 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This is a first batch of backports for AbortController.
This only backports the first semver-minor commit.
This introduces an internal module (internal/timers/promises) to avoid the semver-major change.
Only the timers commit.