Skip to content

Fire Mode: WebView profile management#8575

Merged
0nko merged 34 commits into
developfrom
feature/ondrej/fire-mode-webview-profiles
May 27, 2026
Merged

Fire Mode: WebView profile management#8575
0nko merged 34 commits into
developfrom
feature/ondrej/fire-mode-webview-profiles

Conversation

@0nko

@0nko 0nko commented May 15, 2026

Copy link
Copy Markdown
Member

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_PROFILE API. Each newly-created WebView is bound to its mode-specific androidx.webkit.Profile so cookies, LocalStorage, IndexedDB, and other origin-keyed storage are partitioned per mode. No-op on devices without MultiProfile support.

Pieces introduced:

  • WebViewModeInitializer (browser-mode-api) — binds a freshly-created WebView to the profile for a given BrowserMode. BrowserTabFragment injects it and calls bind(it, browserMode) inside configureWebView() immediately after inflating the DuckDuckGoWebView, before any settings or clients are applied.
  • WebStorageProvider (BrowserModeDataProvider<WebStorage>) — resolves the per-mode WebStorage via ProfileStore, falling back to the shared default WebStorage when MultiProfile is unavailable.
  • BrowserMode.profileName extension — stable mapping from mode to profile name (REGULAR → default profile, FIRE"Fire").
  • FireModeAvailability is now synchronous (fun isAvailable()), uses WebViewFeature.MULTI_PROFILE directly instead of WebViewCapabilityChecker, warms its cache on main-process onCreate via MainProcessLifecycleObserver, and freezes the first computed value so later flag flips don't change the answer mid-session.

API proposal: WebViewModeInitializer interface

Steps to test this PR

  • Smoke test the app and make sure data-clearing works as before. There should be no change to any user-visible functionality

Note

Medium Risk
Changes WebView creation and session storage partitioning at tab open; Fire tabs can be closed if profile binding fails, but Regular mode and devices without MultiProfile should behave as before when binding is skipped or falls back.

Overview
Introduces WebView multi-profile wiring so Regular and Fire tabs use separate AndroidX WebView profiles (cookies, LocalStorage, IndexedDB, etc.), with no binding when MULTI_PROFILE is unsupported.

WebViewModeInitializer binds each new WebView to the profile for the tab’s BrowserMode (via BrowserMode.profileName) before any other WebView setup. BrowserTabFragment calls it right after inflation; if binding fails in a non-Regular mode, it logs, closes the tab, and tears down the WebView.

WebStorageProvider implements BrowserModeDataProvider<WebStorage>, returning profile-scoped storage when Fire/multi-profile is available, otherwise the shared default.

FireModeAvailability is now synchronous, checks WebViewFeature.MULTI_PROFILE directly (replacing WebViewCapabilityChecker), warms availability on main-process onCreate, and freezes the first computed result for the session.

Reviewed by Cursor Bugbot for commit 513ec83. Bugbot is set up for automated code reviews on this repo. Configure here.

0nko commented May 15, 2026

Copy link
Copy Markdown
Member Author

@0nko 0nko assigned 0nko and CDRussell and unassigned 0nko May 15, 2026
@0nko 0nko requested a review from CDRussell May 15, 2026 11:30
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from 9db5ee6 to c9ed552 Compare May 15, 2026 11:32
@0nko 0nko force-pushed the feature/ondrej/fire-mode-rename-modules branch from edcf6dd to 19ab411 Compare May 15, 2026 12:36
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from 3a41216 to 7819973 Compare May 15, 2026 12:36
Base automatically changed from feature/ondrej/fire-mode-rename-modules to develop May 15, 2026 13:00
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from c396ec1 to 40ff4c5 Compare May 15, 2026 13:05
Comment thread browser-mode/browser-mode-impl/build.gradle Outdated
Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt Outdated
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch 2 times, most recently from 4a8d539 to f843786 Compare May 18, 2026 07:54
@0nko 0nko mentioned this pull request May 18, 2026
5 tasks
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from f843786 to b7e580f Compare May 18, 2026 18:54
@0nko 0nko mentioned this pull request May 18, 2026
33 tasks
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from b7e580f to 70343bf Compare May 18, 2026 22:07

@CDRussell CDRussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from 6d5459e to ba1044a Compare May 25, 2026 11:54
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch 2 times, most recently from 36df232 to c3b61be Compare May 26, 2026 09:00
@0nko 0nko force-pushed the feature/ondrej/fire-mode-webview-profiles branch from 018771e to 2de1809 Compare May 27, 2026 09:39

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 ae0a70d. Configure here.

Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt
@0nko 0nko merged commit 0f9da8a into develop May 27, 2026
13 checks passed
@0nko 0nko deleted the feature/ondrej/fire-mode-webview-profiles branch May 27, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants