Repository navigation
fix: stop clearing the app's WebView cache and local storage [ENG-7679] - #100
Open
mattinannt wants to merge 2 commits into
Open
mattinannt wants to merge 2 commits into
mattinannt wants to merge 2 commits into
Conversation
Before every survey the SDK called clearCache() and clearLocalStorage(). On Android both are app-wide (WebView.clearCache(true) and WebStorage.deleteAllData()); on iOS they clear the shared default data store. The host app's own web content lost its data and the renderer was downloaded again for every survey. The web SDK never clears anything before a survey, so the renderer does not need a clean store. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011A96cyBk23EVBB8UX5pL97
Also drop the Sonar comment's claim that the host clears cache and local storage, and name hardenAndLoad in the host's coverage note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011A96cyBk23EVBB8UX5pL97
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes ENG-7679
What & why
Before every survey,
hardenAndLoadinpackages/formbricks/lib/src/widgets/default_webview_host.dartcalledcontroller.clearCache()andcontroller.clearLocalStorage().clearCache()runsWebView.clearCache(true)andclearLocalStorage()runsWebStorage.deleteAllData().WKWebsiteDataStore.As a result, the host app's own web content lost its cache and local storage every time a survey opened, and our renderer was downloaded again for every survey.
This PR removes both calls. The web SDK has never cleared anything before showing a survey, so the renderer doesn't need a clean store. The other hardening steps stay:
baseUrl, so it gets an opaque origin.Why this targets
release/1.3: the ticket asks for 1.3.2 to ship fromrelease/1.3.mainneeds Dart 3.12 / Flutter 3.44, so a release frommainwould leave apps on older Flutter stuck at 1.3.1. Onmain, #99 (ENG-7738) already removes these calls as part of the SDK Core shell.Rejected alternative: clearing only the survey's own store. Android has no per-WebView store, so there is nothing narrower to clear.
Seam:
_hardenAndLoadis nowhardenAndLoad, marked@visibleForTesting, so a unit test can call it with a mockedWebViewController. It is not exported fromlib/formbricks.dart, so the public API is unchanged.Other changes in this PR:
sonar-project.propertieslisted cache/local-storage clearing as one of the WebView protections. It now lists what is actually there. The rules it suppresses are unchanged.hardenAndLoadis tested.Testing
default_webview_host_test.dart, in ahardenAndLoadgroup:clearCachenorclearLocalStorageis called. This test fails onrelease/1.3: I ran it against the 1.3 source with only the rename applied (hardenAndLoad loads the survey without clearing the app's WebView data).onError..fvmrc):make format-check: 0 files changedmake analyze-ci: No issues foundmake test: SUCCESSe2erun on this PR.Risk
Open gaps
chore: bump to 1.3.2PR (version and CHANGELOG entry), then a release fromrelease/1.3. Releasing is left to a human.Generated by Claude Code