-
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
lib: add brand checks to AbortController and AbortSignal #37720
lib: add brand checks to AbortController and AbortSignal #37720
Conversation
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!
Can you add tests? |
@aduh95 Ah, I see, there's a
|
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: James M Snell <[email protected]>
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.
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 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. |
PR-URL: #37720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Landed in feaeb76 |
PR-URL: #37720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #37720 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Web IDL specifies that both attributes and operations of IDL interfaces should throw a
TypeError
ifthis
does not implement the interface. These brand checks were missing forAbortController
andAbortSignal
(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
andCustomEvent
. Node supports the first two but not the last one, so the test would still fail. 😕 Suggestions are welcome!