-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[web] Remove all usages of js_util. #171871
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
[web] Remove all usages of js_util. #171871
Conversation
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 helping out with this cleanup!
I'm curious why you reverted the kIsWeb change?
Hi @mdebbar! First of all, thanks for the review! This is an interesting moment. While changing the
Basically, for the analyzer, this value is |
|
@srujzs any idea why this works: const bool kIsWeb = bool.fromEnvironment('dart.library.js_util');but this doesn't: const bool kIsWeb = bool.fromEnvironment('dart.library.js_interop'); |
|
@mdebbar I've added some interop members as you requested. Regarding your last question, actually |
|
@ksokolovskyi Ah I see now. You explained it in your previous comment too but I didn't catch it :P @mkustermann @srujzs @scheglov could someone help us with the analyzer issue so we can fully migrate off of |
|
It seems like the ideal fix is waiting for dart-lang/sdk#50045 to be resolved, but it doesn't look like that's an easy/simple fix so we should have a special case for |
|
https://dart-review.googlesource.com/c/sdk/+/439820 has landed to workaround this issue for |
|
@srujzs thanks a lot for your workaround! |
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 @srujzs for the quick help!
Everything looks good to me. Once the analyzer change rolls into Flutter and kIsWeb is updated, we can go ahead and land this PR.
engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_app.dart
Outdated
Show resolved
Hide resolved
engine/src/flutter/lib/web_ui/test/engine/view_embedder/flutter_view_manager_test.dart
Outdated
Show resolved
Hide resolved
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.
A couple minor suggestions that I missed previously. Other than that, looks good to me once we address the kIsWeb situation.
This may be more complicated than I imagine but not sure. I suppose one can checkout the latest |
|
The change is very small, so https://dart-review.googlesource.com/c/sdk/+/440263 |
|
Published |
|
@scheglov, thanks a lot! @srujzs @mdebbar I've locally updated the ...
_fe_analyzer_shared: 85.0.0
analyzer: 7.5.9
...But I still have analyzer issues in the IDE or when running |
This may be obvious, but did you also do |
Yep. I am wondering how UPD: I removed |
srujzs
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.
Just some small nits. LGTM!
engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_loader.dart
Outdated
Show resolved
Hide resolved
engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_loader.dart
Outdated
Show resolved
Hide resolved
engine/src/flutter/lib/web_ui/test/engine/pointer_binding_test.dart
Outdated
Show resolved
Hide resolved
|
@srujzs thanks for your comments. Could you please take a quick look at the last commit and confirm that it is what you expected? |
srujzs
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.
Looks great, thanks for addressing the nits!
flutter/flutter@c2739f0...9c626d9 2025-07-17 [email protected] Roll Skia from 5b4afa58289a to 3673a1f26a63 (1 revision) (flutter/flutter#172274) 2025-07-17 [email protected] Roll Fuchsia Linux SDK from JRFUXSNXExcfjVYvA... to HXdm7P0a4ZJVm_TE-... (flutter/flutter#172268) 2025-07-17 [email protected] Roll Dart SDK from d71df90177e4 to 486f9c0663bc (1 revision) (flutter/flutter#172269) 2025-07-17 [email protected] Roll Skia from 3ad1aace3e02 to 5b4afa58289a (3 revisions) (flutter/flutter#172264) 2025-07-17 [email protected] Perform OpenGL compositing in the Flutter thread and write to a framebuffer. (flutter/flutter#172090) 2025-07-17 [email protected] Licenses cpp 716 (flutter/flutter#172261) 2025-07-16 [email protected] Remove emoji from ci.yaml, because we still live with CP1252 for some silly reason (flutter/flutter#172256) 2025-07-16 [email protected] Roll Skia from bf3f9b77d3a8 to 3ad1aace3e02 (11 revisions) (flutter/flutter#172255) 2025-07-16 [email protected] Sync `CHANGELOG.md` (3.32.7) to `master` branch (flutter/flutter#172253) 2025-07-16 [email protected] Properly lay out and position RenderWebImage (flutter/flutter#171916) 2025-07-16 [email protected] Remove dead link in the doc index. (flutter/flutter#172240) 2025-07-16 [email protected] Roll Dart SDK from 766ee8029b11 to d71df90177e4 (1 revision) (flutter/flutter#172243) 2025-07-16 [email protected] Fix use of `Join-Path` in `last_engine_commit.ps1`(poweshell) (flutter/flutter#172242) 2025-07-16 [email protected] Marks Linux_pixel_7pro integration_ui_driver to be unflaky (flutter/flutter#172213) 2025-07-16 [email protected] [skwasm] Decrease reliance on finalizers/GC (flutter/flutter#172187) 2025-07-16 [email protected] Use `release-*.version` to simplify `last_engine_commit.sh` (no branch operations) (flutter/flutter#172236) 2025-07-16 [email protected] Roll Skia from 59be8479c637 to bf3f9b77d3a8 (7 revisions) (flutter/flutter#172233) 2025-07-16 [email protected] [web] Remove all usages of js_util. (flutter/flutter#171871) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Closes flutter#143396 ### Description - Removes `js_util` library usage across the codebase In order to get rid of `dart.library.js_util` in [`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83) constant the dart analyzer has to be updated first. For now, the `dart.library.js_util` value is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…r#9641) flutter/flutter@c2739f0...9c626d9 2025-07-17 [email protected] Roll Skia from 5b4afa58289a to 3673a1f26a63 (1 revision) (flutter/flutter#172274) 2025-07-17 [email protected] Roll Fuchsia Linux SDK from JRFUXSNXExcfjVYvA... to HXdm7P0a4ZJVm_TE-... (flutter/flutter#172268) 2025-07-17 [email protected] Roll Dart SDK from d71df90177e4 to 486f9c0663bc (1 revision) (flutter/flutter#172269) 2025-07-17 [email protected] Roll Skia from 3ad1aace3e02 to 5b4afa58289a (3 revisions) (flutter/flutter#172264) 2025-07-17 [email protected] Perform OpenGL compositing in the Flutter thread and write to a framebuffer. (flutter/flutter#172090) 2025-07-17 [email protected] Licenses cpp 716 (flutter/flutter#172261) 2025-07-16 [email protected] Remove emoji from ci.yaml, because we still live with CP1252 for some silly reason (flutter/flutter#172256) 2025-07-16 [email protected] Roll Skia from bf3f9b77d3a8 to 3ad1aace3e02 (11 revisions) (flutter/flutter#172255) 2025-07-16 [email protected] Sync `CHANGELOG.md` (3.32.7) to `master` branch (flutter/flutter#172253) 2025-07-16 [email protected] Properly lay out and position RenderWebImage (flutter/flutter#171916) 2025-07-16 [email protected] Remove dead link in the doc index. (flutter/flutter#172240) 2025-07-16 [email protected] Roll Dart SDK from 766ee8029b11 to d71df90177e4 (1 revision) (flutter/flutter#172243) 2025-07-16 [email protected] Fix use of `Join-Path` in `last_engine_commit.ps1`(poweshell) (flutter/flutter#172242) 2025-07-16 [email protected] Marks Linux_pixel_7pro integration_ui_driver to be unflaky (flutter/flutter#172213) 2025-07-16 [email protected] [skwasm] Decrease reliance on finalizers/GC (flutter/flutter#172187) 2025-07-16 [email protected] Use `release-*.version` to simplify `last_engine_commit.sh` (no branch operations) (flutter/flutter#172236) 2025-07-16 [email protected] Roll Skia from 59be8479c637 to bf3f9b77d3a8 (7 revisions) (flutter/flutter#172233) 2025-07-16 [email protected] [web] Remove all usages of js_util. (flutter/flutter#171871) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Closes flutter#143396 ### Description - Removes `js_util` library usage across the codebase In order to get rid of `dart.library.js_util` in [`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83) constant the dart analyzer has to be updated first. For now, the `dart.library.js_util` value is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Closes flutter#143396 ### Description - Removes `js_util` library usage across the codebase In order to get rid of `dart.library.js_util` in [`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83) constant the dart analyzer has to be updated first. For now, the `dart.library.js_util` value is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Closes flutter#143396 ### Description - Removes `js_util` library usage across the codebase In order to get rid of `dart.library.js_util` in [`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83) constant the dart analyzer has to be updated first. For now, the `dart.library.js_util` value is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

Closes #143396
Description
js_utillibrary usage across the codebaseIn order to get rid of
dart.library.js_utilinkIsWebconstant the dart analyzer has to be updated first. For now, thedart.library.js_utilvalue is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.