Skip to content

Conversation

@ditman
Copy link
Member

@ditman ditman commented May 26, 2022

The current version of flutter.js is using 'public class fields' (docs) that weren't supported in Safari until v14.1.

This PR removes the public class field syntax, and uses instead a 'constructor' method to initialize public fields in the FlutterLoader class, which is more broadly supported (docs), importantly by Safari 13.

Fixes #104646

Testing

Testing needs to be manual, because it's almost impossible to get Safari 13 on any updated device. An iOS simulator (or an old device) are required to use the affected browser.

This PR is now deployed here:

Point Safari on an iOS Simulator on iOS 13 there to see that it loads. Compare with gallery.flutter.dev.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • 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.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ditman ditman requested review from mdebbar and yjbanov May 26, 2022 22:09
@flutter-dashboard
Copy link

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.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 26, 2022
@ditman ditman changed the title [tool][web] Make flutter.js work in Safari 13 [tool][web] Fix flutter.js in Safari 13 May 26, 2022
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yjbanov
Copy link
Contributor

yjbanov commented May 27, 2022

A test exemption is reasonable because we don't have infra to test on ancient versions of iOS Safari.

@Hixie
Copy link
Contributor

Hixie commented May 27, 2022

can we test this by scanning the code for patterns known to not work in old Safaris we want to support?

if not:
test-exempt: intractable

@ditman
Copy link
Member Author

ditman commented May 27, 2022

can we test this by scanning the code for patterns known to not work in old Safaris we want to support?

@Hixie I tried to use eslint + eslint-plugin-compat specifying the browsers we want to support, and it wasn't very trust-worthy. If eslint was adjusted to recognize the syntax (es2022) for the browsers that would support it to pass, the compat plugin wouldn't complain about it for Safari 13. This would have also required to bring node as a build dependency (or to somehow shrink-wrap the eslint tool, which I'm not sure is possible).

I also looked at esbuild, which seems more promising, because you can feed it JS written in any syntax level, and it'll automatically transform it to something that complies with a specific target (targets can be es6 but also safari 13, or a combo of them), even minify it, so this might stop being a problem altogether. I've created an issue to dive deeper into that option here: #104777 (which could be a great package for post-processing of the web assets).

For now, I'm going to land this, but it is true that there's more changes coming here that are hard to test (if at all possible)

(PS: Another way of handling this is converting flutter.js in a node package, maintained separately from flutter/flutter_tools, but that might be overkill)

@fluttergithubbot fluttergithubbot merged commit b7eaad8 into flutter:master May 27, 2022
@ditman ditman deleted the web-flutter-js-constructor-method branch May 27, 2022 00:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 7, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter web not working on iOS web having OS version less than 14.1

5 participants