Bug 43359: Improper handling of TorBootstrapChangeListener with respect to system onDestroy() calls on HomeActivity
Merge Info
Issues
Resolves
Merging
Target Branches
-
tor-browser
-!fixups
totor-browser
-specific commits, new features, security backports -
base-browser
andmullvad-browser
-!fixups
tobase-browser
-specific commits, new features to be shared withmullvad-browser
, and security backports-
⚠️ IMPORTANT: Please list thebase-browser
-specific commits which need to be cherry-picked to thebase-browser
andmullvad-browser
branches here
-
Target Channels
-
Alpha: esr128-14.5 -
Stable: esr128-14.0 -
Legacy: esr115-13.5
Backporting
Timeline
-
No Backport (preferred): patchset for the next major stable -
Immediate: patchset needed as soon as possible -
Next Minor Stable Release: patchset that needs to be verified in nightly before backport -
Eventually: patchset that needs to be verified in alpha before backport
(Optional) Justification
-
Emergency security update: patchset fixes CVEs, 0-days, etc -
Censorship event: patchset enables censorship circumvention -
Critical bug-fix: patchset fixes a bug in core-functionality -
Consistency: patchset which would make development easier if it were in both the alpha and release branches; developer tools, build system changes, etc -
Sponsor required: patchset required for sponsor -
Localization: typos and other localization changes that should be also in the release branch -
Other: please explain
Issue Tracking
-
Link resolved issues with appropriate Release Prep issue for changelog generation
Review
Request Reviewer
-
Request review from an applications developer depending on modified system: -
NOTE: if the MR modifies multiple areas, please
/cc
all the relevant reviewers (since Gitlab only allows 1 reviewer) - accessibility : henry
- android : clairehurst, dan
- build system : boklm
- extensions : ma1
- firefox internals (XUL/JS/XPCOM) : jwilde, ma1
- fonts : pierov
- frontend (implementation) : henry
- frontend (review) : donuts, morgan
- localization : henry, pierov
- macOS : clairehurst, dan
- nightly builds : boklm
- rebases/release-prep : dan, ma1, pierov, morgan
- security : jwilde, ma1
- signing : boklm, morgan
- updater : pierov
- windows : jwilde, morgan
- misc/other : pierov, morgan
-
NOTE: if the MR modifies multiple areas, please
Change Description
TLDR: Moved code into appropriate block so that it won't be called at inappropriate times. Also and added a check to make sure it only affects the html bootstrap and also to clarify that it should only affect html bootstrap.
The function unregisterBootstrapStateChangeListener
was being called in HomeActivity.kt
's onDestroy()
, but without a check for if its finishing/not being recreated, which means that it will still be called even when the activity isn't "finished" and is actually just being temporarily destroyed to free up resources (this often happens when the app is backgrounded for a while, for instance).
Fortunately, I think this would only be causing issues with the html bootstrap (and only for long running applications that have stayed on the bootstrap screen) as it should be the only thing using HomeActivity's bootstrap listener (Native android has that covered in a separate view model). For instance, if the app stayed on the html bootstrap screen for a long enough time for onDestroy() to be called it would stop listening to new bootstrap events and likely cause an unresponsive UI and require an app restart.
How Tested
I haven't tested this other than making sure it still works as intended. It would take a long time to test (roughly 24h or so per test and even then it would still be flakey so we'd need to do it a few times to be sure) and this is an edge case for html only, so I think just reading the code and reading the documentation for onDestroy() should suffice