Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter_android] Clear local storage when clearCache is called#5086

Merged
bparrishMines merged 13 commits intoflutter:mainfrom
bparrishMines:webstorage
Mar 31, 2022
Merged

[webview_flutter_android] Clear local storage when clearCache is called#5086
bparrishMines merged 13 commits intoflutter:mainfrom
bparrishMines:webstorage

Conversation

@bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Mar 19, 2022

Fixes regression where local storage wasn't cleared when WebViewController.clearCache was called:

Original Code: 8f55fb6#diff-60861265259b6695609221b1bb21919e63a6357ac8d04fdf9fef1b4e4b045e82L371

No version change: This only adds an integration test to webview_flutter.
No CHANGELOG change: This only adds an integration test to webview_flutter.

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 relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • 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.

@github-actions github-actions bot added p: webview_flutter Edits files for a webview_flutter plugin platform-android labels Mar 19, 2022
@bparrishMines bparrishMines changed the title Webstorage [webview_flutter_android] Clear local storage when clearCache is called Mar 19, 2022
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Wow, this definitely demonstrates the downside to directly wrapping an API with a constellation of objects. I guess the mitigation here is that adding a whole new object wrapper will become very rare over time.


* Fixes bug preventing `mockito` code generation for tests.
* Fixes regression where local storage wasn't cleared when `WebViewController.clearCache` was
called.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a new integration test for this case? It seems like a very good candidate for integration testing since the high-level behavior is easily expressible in a user-visible way, so should be easy to do an integration test for.

It would also be good to add to the app-facing package, since the original mistake here demonstrates that an implementor could easily miss part of the intended behavior here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I added it to the app-facing package as well, but it is skipped for Android. I also added a TODO to remove the skip once a new version is published.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the test!

(I believe the federated safety check will fail on this now, but it's safe to override with the PR message in this case.)

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

Labels

p: webview_flutter Edits files for a webview_flutter plugin platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants