lib: add brand checks to AbortController and AbortSignal#37720
lib: add brand checks to AbortController and AbortSignal#37720MattiasBuelens wants to merge 6 commits intonodejs:masterfrom MattiasBuelens:abort-controller-brand-checks
Conversation
|
Can you add tests? |
|
@aduh95 Ah, I see, there's a
|
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>
aduh95
left a comment
There was a problem hiding this comment.
LGTM
IDL tests do not test against "bad"
thiscontexts 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 <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
Landed in feaeb76 |
PR-URL: #37720 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#37720 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Web IDL specifies that both attributes and operations of IDL interfaces should throw a
TypeErrorifthisdoes not implement the interface. These brand checks were missing forAbortControllerandAbortSignal(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,EventandCustomEvent. Node supports the first two but not the last one, so the test would still fail. 😕 Suggestions are welcome!