Skip to content

Conversation

@david-landeros
Copy link
Contributor

@david-landeros david-landeros commented Nov 15, 2022

As a performance improvement, this PR ensure service worker starts caching assets since the very first load by calling self.clients.claim(),

Fixes: #115336

This is how the service worker behaves now:

  • Load page for the first time, and service worker gets installed
  • Request asset cat.jpg and service worker caches it right away
  • Load the page for the 2nd time and it must be taken from the cache.
cat-fixed.mp4

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 updated existing tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@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 Nov 15, 2022
@david-landeros
Copy link
Contributor Author

david-landeros commented Nov 15, 2022

service_worker.js is particularly hard to test, can someone advice on how to add an integration test for this change?
The change is quite subtle though, it's probably a valid exception

@christopherfujino
Copy link
Contributor

@ditman can you take a look at this one?

@ditman
Copy link
Member

ditman commented Nov 17, 2022

Ha, the tests that are failing are doing so because this is working better now, for example:

  • location ['main.dart.js'] is <1> instead of <2>

That number is "the number of times it was downloaded from the server", which kinda makes sense is 1 now. I'll review the tests to make sure we're not introducing anything nefarious (like an un-updateable service worker or similar :P)

@ditman ditman self-requested a review November 17, 2022 21:38
@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Nov 19, 2022
@david-landeros
Copy link
Contributor Author

david-landeros commented Nov 19, 2022

Hi, @ditman I updated those integration test to expect fewer requests

@ditman
Copy link
Member

ditman commented Nov 22, 2022

@davidlanderos-digital thanks! I'm finishing something urgent, but this notification is living in my Notifications forever now, until I review it. I want to also bring this up with the web team so they can take a second look (ETA for a decision: week 48!)

…#115837)

* 9990a4b1d [ci] Improve analysis_options alignment with flutter/packages (flutter/plugins#6728)

* 7abe5a79c Roll Flutter from 633d7ef to 2962228 (13 revisions) (flutter/plugins#6730)

* 5d847ef39 [sign_in]: Bump play-services-auth from 20.3.0 to 20.4.0 in /packages/google_sign_in/google_sign_in_android/android (flutter/plugins#6726)
* remove ciyaml targets

* remove screenshot_test and package:image

* update-packages

* remove TESTOWNERS entries
…lutter#115842)

* eba7ecddc Add setImageSampler (for replacing setSampler) (flutter/engine#37821)

* 15dce5e11 Roll Skia from 57b4252cf211 to 550fd51bd254 (3 revisions) (flutter/engine#37830)

* 9b07044e7 Revert "[impeller] Remove declare_undefined_values (flutter#37829)" (flutter/engine#37831)

* 1a6180869 Roll Dart SDK from 6b8e98070f26 to 27c45cd51796 (1 revision) (flutter/engine#37833)

* 8bc415423 Roll Skia from 550fd51bd254 to 94c63addc990 (1 revision) (flutter/engine#37834)

* 7b4291548 Roll Skia from 94c63addc990 to 0dec6d1823b3 (4 revisions) (flutter/engine#37836)

* a7fa7c6ec Roll Fuchsia Linux SDK from xBfEjlXUsix6Wka-i... to 5Xd8MJTM-pWPWCgUa... (flutter/engine#37840)

* b6e33b527 Roll Fuchsia Mac SDK from oaqX39ssn3PUxE9it... to mwKdD1jX_KVP1U76z... (flutter/engine#37844)

* 37e2aaa90 Roll Skia from 0dec6d1823b3 to 3b2d9e4bf668 (1 revision) (flutter/engine#37845)
* Update message_codec.dart

* remove whitespace

* Update doc comment

* Update message_codec.dart
…ags (flutter#115862)

* [flutter_tools] Add --dump-info, --no-frequency-based-minification flags

Also some cleanup to named arguments to the buildWeb function

Fixes flutter#115854

* fix tests
…lutter#115881)

* c05e7ff9b [Impeller] opt float/sampler into relaxed precision for gles (flutter/engine#37828)

* 256dc78f6 Reland "[web] Avoid returning int from js interop classes." (flutter/engine#37627)

* 5ab29c95a [web] Move unicode properties to third_party (flutter/engine#37440)

* 10da1a1f0 Remove setSampler from FragmentShader (flutter/engine#37839)

* a800e7650 [Impeller] make VerticesGeometry delegate to the DL class (flutter/engine#37835)

* 1067cd2b7 Roll Skia from 3b2d9e4bf668 to 3bd2fe46f6d2 (2 revisions) (flutter/engine#37848)

* 2d8e53925 change cloneImageElement() to return clone every time (flutter/engine#37811)

* cefb954e0 fix pixel ratio (flutter/engine#37268)

* c6b2ced1e Set nested clip nodes (flutter/engine#37850)

* c7ecca866 Roll Skia from 3bd2fe46f6d2 to c098e3c5d932 (2 revisions) (flutter/engine#37851)

* afac22d6c Made platform message responses threadsafe for macos. (flutter/engine#37607)

* a805efffb fix docs analysis error on setImageSampler (flutter/engine#37852)
…lutter#115888)

* 3c2784757 Turn on darwin-* clang-tidy checks (flutter/engine#37814)

* 4bf16c369 Turn on objc-* clang-tidy checks (flutter/engine#37813)
…lutter#115891)

* 8e458a2b6 [Impeller] Set color attachment pixel format to RGBA on OpenGLES backend (flutter/engine#37843)

* f75287af0 [Windows] Refactor `PlatformHandler`'s tests (flutter/engine#37820)
…lutter#115897)

* 3db51dc63 Roll Fuchsia Linux SDK from 5Xd8MJTM-pWPWCgUa... to NlJGkMbtZqQ6_BCpu... (flutter/engine#37861)

* e6d9fffe8 Roll Fuchsia Mac SDK from mwKdD1jX_KVP1U76z... to zoBKUSYFpDq3XtJZ4... (flutter/engine#37862)
…#115930)

* 2a5239495 [ci] Import flutter/packages install_chromium.sh (flutter/plugins#6727)

* e484dec84 Switch `ios_platform_tests` from Cirrus to LUCI (flutter/plugins#6729)

* fb0a593d6 Roll Flutter from 2962228 to 06d90b8 (17 revisions) (flutter/plugins#6742)

* dd493f5b1 [path_provider] Remove unused Guava dependency (flutter/plugins#6744)

* b2d4ee5ce [google_sign_in] Roll Guava dependency to 31.1 (flutter/plugins#6746)

* be855018f [ios_platform_images] remove deprecated APIs (flutter/plugins#6693)

* a431b35bf Roll Flutter from 06d90b8 to 0eb2d51 (17 revisions) (flutter/plugins#6750)
loic-sharma and others added 23 commits December 8, 2022 14:05
Adds a test to verify the console output of `flutter run --release` on Windows.

Part of: flutter#111577
* init

* add comment

* make error more actionable
…ter#116635)

* Roll Flutter Engine from 67254d6e4b03 to 8d83b98c55b3

* Roll Dart SDK from 35a9facce191 to e517487c5679 (Dart 3.0) (flutter#38105)

* Bump SDK versions.

* Bump Dart SDK version constraints

* Update shrine package to 2.0.1 (null safe version)

* Fix more tests.

* Include patches from Jason for min android sdk version

* Fix analyzer warning
…#116781)

* 929c9a632 [camera] Re-enable ability to concurrently record and stream video (flutter/plugins#6808)

* f31a438f3 [video_player] Fix file URI construction (flutter/plugins#6803)

* 6ab7d710d Roll Flutter from a570fd2 to 521028c (11 revisions) (flutter/plugins#6810)
* Add Material 3 support for `ListTile` - Part 1

* minor refactor

* Add `useMaterial3: false` to M2 tests
It includes the following changes:

* Adds main as the enabled branches.
* Adds docs_beta and docs_stable to pass the expected gcp project.
* Adds dimensions to packaging arm64 to ensure that it runs on arm64
  bot.

Bug: https://github.com/orgs/flutter/projects/43
…lutter#116802)

* bd8bcf956 Roll Fuchsia Mac SDK from crEcyXdyZ686cAqMV... to pMV6A0ykZQ8aA3NG2... (flutter/engine#38120)

* dec8b5221 Preliminary implementation of UIA for A11y on Windows (flutter/engine#37754)

* 5545ccf87 Roll Fuchsia Linux SDK from NlJGkMbtZqQ6_BCpu... to xn8ztWtp-zww-jObz... (flutter/engine#38122)

* 80a15a419 Create FlutterActivity/FlutterFragment using light weight engine with FlutterEngineGroup (flutter/engine#36963)

* 5caef8585 Full implementation of text-input-test (flutter/engine#37986)

* 8f6036e58 Reland fix wrong VSYNC event (flutter/engine#37865)

* 4101c363c [iOS] Change locale format for spell check (flutter/engine#38080)

* 2f5b67e4d [embedder] Ensure destruction called on present (flutter/engine#38078)

* 0bddc6045 [Impeller Scene] Depth attachment; baked lighting example (flutter/engine#38118)

* 6aa4ccd60 Remove dlCanvasRecorder from flutter::PictureRecorder (flutter/engine#38127)

* dbb5284f2 [Windows] Add more cursor plugin tests (flutter/engine#38112)

* 6e91204d9 Roll Fuchsia Mac SDK from pMV6A0ykZQ8aA3NG2... to 9SnrQ0vbR8IC7UIoP... (flutter/engine#38135)

* 3140ad924 [Impeller] order metal samplers according to declared order and not usage order (flutter/engine#38115)

* 84abf21d4 Remove autoninja. (flutter/engine#38136)

* 8a113d328 [embedder] Expose metal surface from test context (flutter/engine#38133)

* 1ef25b63f Roll Fuchsia Mac SDK from 9SnrQ0vbR8IC7UIoP... to aMW0DjntzFJj4RoR3... (flutter/engine#38139)

* 748b3bc15 Revert "Remove dlCanvasRecorder from flutter::PictureRecorder (flutter#38127)" (flutter/engine#38137)

* b6daf3d06 [embedder] Consistent naming for GL/Metal tests (flutter/engine#38141)

* 339d04baf [web] Trivial fix for non-static interop JS interop class. (flutter/engine#38126)

* 1fcbb9c11 [tools] Eliminate version on Obj-C docs (flutter/engine#38145)

* 71928b6a4 [Impeller] Use DrawPath instead of Rect geometry when the paint style is stroke (flutter/engine#38146)

* 23ce8fdbc Roll Skia from dd3285a80b23 to f84dc9303045 (4 revisions) (flutter/engine#38123)

* 366f8663b Roll Skia from f84dc9303045 to 2691cd7b4110 (40 revisions) (flutter/engine#38151)

* 447e7013e Roll Skia from 2691cd7b4110 to 711396b81248 (1 revision) (flutter/engine#38152)

* cd5d91bf9 Pylint testing/run_tests.py (flutter/engine#38016)

* aafac083b Roll Skia from 711396b81248 to b253b10374e7 (7 revisions) (flutter/engine#38157)

* 799dc78e8 Roll Fuchsia Linux SDK from xn8ztWtp-zww-jObz... to rRJIjuO-dPNCpCTd9... (flutter/engine#38134)

* 3aa3d2a8f Massage the JS interop around `didCreateEngineInitializer` (flutter/engine#38147)

* 030950f30 Roll Skia from b253b10374e7 to ec407902999b (3 revisions) (flutter/engine#38158)
…lutter#116811)

* 2121d8187 [web] Use js_util.promiseToFuture with CanvasKitInit() (flutter/engine#38128)

* a259613ab Fix premature LayerStateStack layer culling (flutter/engine#38159)
…lutter#116813)

* 59fabcc89 Roll Skia from ec407902999b to 44062eff3e25 (8 revisions) (flutter/engine#38161)

* 8b56b5a98 Roll Dart SDK from e517487c5679 to 0940b5e6ccd5 (3 revisions) (flutter/engine#38162)
* Floating cursor cleanup

* Use TextSelection.fromPosition
… first launch by calling self.clients.claim()
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 10, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Dec 10, 2022

auto label is removed for flutter/flutter, pr: 115374, due to - The status or check suite cla/google has failed. Please fix the issues identified (or deflake) before re-applying this label.

@david-landeros
Copy link
Contributor Author

@christopherfujino Hi, this PR is messed up because of the rebase, i'm closing it in favor of a this new PR #116833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. e: flutter.js Issues with Flutter web custom initialization through JS APIs platform-web Web applications specifically 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] Assets are downloaded again in the 2nd visit despite service worker