Fix startup crash caused by corrupted cookie store - #6944
Conversation
|
Hi @RitikaPahwa4444, when you have time, could you please review this PR? The fix and regression tests are included, and I also validated the recovery behavior on a physical device across multiple corrupted cookie-store inputs. Please let me know if any changes or additional testing would be helpful. |
|
I'll start testing 🙂 |
|
✅ Generated APK variants! |
|
Hey @RitikaPahwa4444, just checking in, how's the testing going on this one? Happy to add more test coverage or make changes if anything came up. Also flagging in case it's confusing: the failing check-scope check isn't related to this PR's code. The job log shows it's hitting a 410 from GitHub's own AI-inference service ("GitHub Models is temporarily unavailable as part of a scheduled retirement brownout"), so that's an outage on GitHub's end, not something in the diff. Android CI is passing fine. |
Description (required)
Fixes #6915
CommonsCookieStorage.load()previously allowed malformed persisted cookie data to throw during application startup, leaving both the main process and ACRA process in a persistent crash loop.This change treats an unreadable cookie store as an invalid saved session. It keeps the in-memory cookie collection empty, removes only the corrupted
cookie_storepreference, logs the recovery, and leaves unrelated preferences intact. Valid cookie stores and the existing plaintext-to-encrypted migration behavior are unchanged.Unit tests cover malformed and truncated JSON, JSON
null, blank values, incorrect top-level types, invalid domain values, valid empty and populated stores, invalid individual cookies, unrelated-preference preservation, and repeated loading after recovery.Tests performed (required)
CommonsCookieStorageTestand adjacentJsonKvStoreTestsuites on BetaDebug: 16 tests, 0 failures.null, a top-level array, an invalid domain value, and whitespace-only data.Screenshots (for UI changes only)
Not applicable; this change has no UI modifications.