[flutter.js] Wait for reg.update, then activate sw (if not active yet).#101464
[flutter.js] Wait for reg.update, then activate sw (if not active yet).#101464fluttergithubbot merged 6 commits intoflutter:masterfrom ditman:fix-service-worker-update-corner-case
Conversation
|
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. |
yjbanov
left a comment
There was a problem hiding this comment.
Is there a way to test this?
|
Oh, wait, I missed your comment:
What causes the service worker to change to trigger this code path? This test is attempting to do something like that: https://github.com/flutter/flutter/blob/master/dev/bots/service_worker_test.dart |
I think what we need to do is to have:
(I think, not entirely sure) |
…hem from bots/test.dart.
|
I've added a new test to
That does exercise the code path where the serviceworker IS updated, but it doesn't trigger the issue on my machine :S Also expanded the service worker test to have 3 different initializations: without flutter js, with flutter js and all the steps, and with flutterJS "short" (calling autoStart directly). |
…is maintained after the service_worker_test.dart ends.
…103101) * Add the new hash * [flutter.js] Wait for reg.update, then activate sw (if not active yet). (#101464) * Avoid scheduling a forced frame when there is no child to the renderView (#102556) * Migrate AppBar to Material 3 (#101884) * Keeping the super parameters * Fixing semi-colon issue Co-authored-by: David Iglesias <[email protected]> Co-authored-by: Dan Field <[email protected]> Co-authored-by: Darren Austin <[email protected]>

In this PR we handle the
updatecase of Flutter Web service worker slightly better, by awaiting on the promise returned by it, instead of using the instance upon which update was called.Once that's done, we fetch the service worker in the state in which it might be, and pass it to the method that waits for its activation (if needed!).
Fixes #101459
Tests: Added a test that goes through the code path that was failing, but I couldn't reproduce the failure :/
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.