-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Add explicit JS type test for JsStrategy.
#39765
Conversation
|
@mdebbar ptal, I think you may have added this test a few years ago. I'm not sure how we want to handle this, but this test relies on not well specified behavior of JS interop. In particular, JS interop APIs don't have the same type checking guarantees that Dart APIs do, and as we iterate on the new JS interop, these guarantees will be weakened further. I'm not sure the best path forward. I think the best 'type checking' we can do is ensure that when we |
efa2af9 to
4cfdcba
Compare
|
Would it work if we added type-checking here? : engine/lib/web_ui/lib/src/engine/initialization.dart Lines 275 to 278 in eb5e562
We are not type-checking the function here, we are type-checking the arguments passed to the function. We need to make sure the argument is a |
4cfdcba to
f63525a
Compare
JsStrategy.
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
f63525a to
9405259
Compare
|
Good call, I added a check for |
mdebbar
left a comment
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.
Thanks for fixing this!
9405259 to
603623a
Compare
c51ab16 to
d13d6b9
Compare
Type checking is not well defined with JS interop. A safer approach is to type check JS values in JS using js_util. This CL implements such an explicit test.