GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: add brand checks to AbortController and AbortSignal by MattiasBuelens · Pull Request #37720 · nodejs/node

Conversation

@MattiasBuelens

@MattiasBuelens MattiasBuelens commented Mar 11, 2021

Copy link
Copy Markdown
Contributor

Web IDL specifies that both attributes and operations of IDL interfaces should throw a TypeError if this does not implement the interface. These brand checks were missing for AbortController and AbortSignal (as noticed here), so I added them.

Unfortunately, this is not straightforward to test. WPT has an IDL test for this, but it's bunched up together with other IDL tests for EventTarget, Event and CustomEvent. Node supports the first two but not the last one, so the test would still fail. 😕 Suggestions are welcome!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

LinusU and bricss reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 11, 2021
@MattiasBuelens MattiasBuelens mentioned this pull request Mar 11, 2021
Implement using web-streams-polyfill nodejs/whatwg-stream#3
Closed
4 tasks done
aduh95
aduh95 reviewed Mar 11, 2021
View reviewed changes
Comment thread lib/internal/abort_controller.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/abort_controller.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell reviewed Mar 11, 2021
View reviewed changes
Comment thread lib/internal/abort_controller.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Ethan-Arrowood
Ethan-Arrowood approved these changes Mar 12, 2021
View reviewed changes

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

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 LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aduh95

aduh95 commented Mar 13, 2021

Copy link
Copy Markdown
Contributor

Can you add tests?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MattiasBuelens

MattiasBuelens commented Mar 14, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@aduh95 Ah, I see, there's a test/parallel/test-abortcontroller.js file. Sure, I'll add some tests.

They'll kind of duplicate the WPT IDL tests, but as long as we can't run those against Node yet, I suppose duplicating them makes sense. Actually, my initial assumption was wrong: the IDL tests do not test against "bad" this contexts in method calls. So we definitely need our own tests. 🙂

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MattiasBuelens
MattiasBuelens commented Mar 14, 2021
View reviewed changes
Comment thread test/parallel/test-abortcontroller.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

MattiasBuelens and others added 5 commits March 15, 2021 22:23
@MattiasBuelens
lib: add brand checks to AbortController and AbortSignal
64abc04
@MattiasBuelens @aduh95
lib: use optional chaining in brand checks
048ab00
Co-authored-by: Antoine du Hamel <[email protected]>
@MattiasBuelens @jasnell
lib: reformat require for internal/errors
1de2c66
Co-authored-by: James M Snell <[email protected]>
@MattiasBuelens
test: check if AbortController and AbortSignal validate the receiver
bc87164
@MattiasBuelens
test: reword comments
2469b73
jasnell
jasnell approved these changes Mar 15, 2021
View reviewed changes
aduh95
aduh95 approved these changes Mar 15, 2021
View reviewed changes

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

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.

LGTM

IDL tests do not test against "bad" this contexts in method calls

It may be worth opening a PR to add those tests upstream to make sure the behaviour stays consistent.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MattiasBuelens reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@MattiasBuelens
test: check undefined as well
8fa7c54
@MattiasBuelens MattiasBuelens mentioned this pull request Mar 16, 2021
Test if AbortController and AbortSignal perform brand checks web-platform-tests/wpt#28092
Closed
@MattiasBuelens

MattiasBuelens commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

Okay, so my correction on my initial assumption was wrong. 😅 As Domenic pointed out, the IDL harness does try to call getters and methods with a "bad" receiver to check if they throw a TypeError. So we don't need to upstream any tests, this is already covered by the WPT IDL tests. My apologies for the confusion.

Once Node can run the IDL tests, we can remove these newly added tests. But for now, they are necessary, so I'll leave them in.

aduh95 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 18, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36786/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Mar 18, 2021
@nodejs-github-bot

nodejs-github-bot commented Mar 19, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36799/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Mar 19, 2021
View reviewed changes
jasnell pushed a commit that referenced this pull request Mar 19, 2021
@MattiasBuelens @jasnell
lib: add brand checks to AbortController and AbortSignal
feaeb76
PR-URL: #37720
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@jasnell

jasnell commented Mar 19, 2021

Copy link
Copy Markdown
Member

Landed in feaeb76

MattiasBuelens and Ethan-Arrowood reacted with hooray emoji
All reactions
  • 🎉 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell closed this Mar 19, 2021
@MattiasBuelens
MattiasBuelens deleted the abort-controller-brand-checks branch March 20, 2021 23:13
ruyadorno pushed a commit that referenced this pull request Mar 24, 2021
@MattiasBuelens @ruyadorno
lib: add brand checks to AbortController and AbortSignal
af7489c
PR-URL: #37720
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Mar 30, 2021
v15.13.0 proposal #37977
Merged
@targos targos added the backport-open-v14.x label Apr 24, 2021
@targos targos mentioned this pull request Apr 24, 2021
[v14.x] Backport AbortController and friends #38386
Closed
targos pushed a commit to targos/node that referenced this pull request Apr 30, 2021
@MattiasBuelens @targos
lib: add brand checks to AbortController and AbortSignal
10131cd
PR-URL: nodejs#37720
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Apr 30, 2021
@MattiasBuelens @targos
lib: add brand checks to AbortController and AbortSignal
b1507c4
PR-URL: #37720
Backport-PR-URL: #38386
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@targos targos added backported-to-v14.x and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. backport-open-v14.x labels Apr 30, 2021
@danielleadams danielleadams mentioned this pull request May 3, 2021
v14.17.0 proposal #38507
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@aduh95 aduh95 aduh95 approved these changes
@Ethan-Arrowood Ethan-Arrowood Ethan-Arrowood approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@MattiasBuelens @aduh95 @nodejs-github-bot @jasnell @Ethan-Arrowood @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.