Fire Mode: WebView profile management#8575
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
9db5ee6 to
c9ed552
Compare
|
|
||
| @Volatile | ||
| private var multiProfileSupported: Boolean? = null | ||
| private var cachedAvailability: Boolean? = null |
There was a problem hiding this comment.
The availability is cached because if the flag changed mid-run, different profiles might be used, which could result in unexpected behavior.
edcf6dd to
19ab411
Compare
3a41216 to
7819973
Compare
c396ec1 to
40ff4c5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1c4058. Configure here.
4a8d539 to
f843786
Compare
f843786 to
b7e580f
Compare
b7e580f to
70343bf
Compare
CDRussell
left a comment
There was a problem hiding this comment.
Smoke tested and it looked ok to me. Reluctant to approve the PR if the public API changes are not covered in a proposal, though. which I didn't think they were (maybe I misremember); are they covered? Because if not, probably will result in changes to these again before merging.
| * No-op on devices that do not support the `MULTI_PROFILE` WebView feature; such callers | ||
| * implicitly share the default profile across modes. | ||
| */ | ||
| interface WebViewProfileBinder { |
There was a problem hiding this comment.
are these public API changes covered in a proposal already, for WebViewProfileBinder and WebViewProfileBinder ?
FireModeAvailability had one, though now modified from it to remove suspend.
There was a problem hiding this comment.
Added the link for WebViewProfileBinder to the PR description.
6d5459e to
ba1044a
Compare


Task/Issue URL: https://app.asana.com/1/137249556945/project/1207418217763355/task/1214780084779090?focus=true
Description
Isolates WebView state between Regular and Fire browser modes via AndroidX webkit's
MULTI_PROFILEAPI. Each newly-createdWebViewis bound to its mode-specificandroidx.webkit.Profileso cookies, LocalStorage, IndexedDB, and other origin-keyed storage are partitioned per mode. No-op on devices without MultiProfile support.BrowserTabFragmentinjectsWebViewProfileBinderand callsbind(it, browserMode)insideconfigureWebView()immediately after inflating theDuckDuckGoWebView, before any settings are applied.API proposal: WebViewProfileBinder interface
Steps to test this PR
Note
Medium Risk
Changes when and how WebViews are profile-bound and how Fire availability is computed; mistakes in bind ordering or profile selection could affect cookie/storage isolation or Fire behavior.
Overview
This PR wires Fire vs Regular browser modes to separate AndroidX WebView profiles when
MULTI_PROFILEis supported, so cookies and origin storage (LocalStorage, IndexedDB, etc.) can stay partitioned per mode.A new
WebViewModeInitializeris called fromBrowserTabFragmentright after the tabWebViewis inflated and before any other WebView setup, binding the view to the profile for the currentBrowserMode(REGULARuses the default profile;FIREuses a dedicated"Fire"profile).RealWebViewModeInitializerno-ops when Fire/multi-profile is unavailable.WebStorageProviderresolves per-modeWebStorageviaProfileStorewhen multi-profile is on, otherwise the shared default instance.BrowserMode.profileNamecentralizes the profile name mapping.FireModeAvailabilityis now synchronous (no longersuspend), caches availability at process start and on first read, and checksWebViewFeature.MULTI_PROFILEplus the Fire tabs flag instead ofWebViewCapabilityChecker. Tests were adjusted for the new caching and sync API.Reviewed by Cursor Bugbot for commit ba1044a. Bugbot is set up for automated code reviews on this repo. Configure here.