chromium: Fail clearData explicitly instead of faking success - #2060
Open
NAME-ASHWANIYADAV wants to merge 1 commit into
Open
chromium: Fail clearData explicitly instead of faking success#2060NAME-ASHWANIYADAV wants to merge 1 commit into
NAME-ASHWANIYADAV wants to merge 1 commit into
Conversation
Contributor
Author
|
@svillar PTAL !! |
svillar
requested changes
Sep 1, 2026
| session.recreateSession(); | ||
| } | ||
| return null; | ||
| }, throwable -> { |
Member
There was a problem hiding this comment.
instead of repeating the for loop can we do instead
whenComplete((aVoid, throwable) -> {
if (throwable != null) {
Log.e(LOGTAG, "Failed to clear browsing data", throwable);
}
for (Session session : activeSession) {
session.recreateSession();
}
The Chromium clearData stub returned a completed WResult while clearing nothing, so clearing browsing data reported success. Add WResult.whenComplete so SessionStore.clearCache logs the failure and still recreates the suspended sessions. Fixes Igalia#2061
NAME-ASHWANIYADAV
force-pushed
the
fix/chromium-cleardata-honest-failure
branch
from
September 1, 2026 16:44
a9eff6b to
2bd3d6d
Compare
Contributor
Author
|
@svillar will appreciate a re-review !! |
Contributor
Author
|
One note: WResult didn't have whenComplete, so I added it as a default method mirroring CompletableFuture.whenComplete (built on the existing two-listener then, so both backends get it for free), and clearCache now uses exactly the shape you suggested. Also rebased on main and added the Fixes line to the commit |
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 #2061
What
Two coordinated changes:
RuntimeImpl.clearData()stub now returnsWResult.fromException(new UnsupportedOperationException(...))instead of an already-completed success. TheTODOstays to signal that real clearing against the Chromium engine is a follow-up.SessionStore.clearCache()now uses the two-listenerthen(valueListener, exceptionListener)overload: on failure it logs the error and still recreates the suspended sessions.Why
The stub returned
WResult.fromValue(null), so callers took their success path with nothing cleared. The user-facing path is Settings → Privacy → "clear cookies and site data" / "clear web content" (PrivacyOptionsView.java:74-83) →SessionStore.clearCache(). On Chromium the sessions suspend and reload, so the action looks like it worked - while cookies, site data and caches are untouched. The Gecko backend really clears (gecko/RuntimeImpl.java:91-92).Failing the result alone - the way
capturePixelswas handled in #2025 - would have regressed this path:clearCache()suspends every session before callingclearData(), andrecreateSession()lived only inside.then()with no.exceptionally(). An honest failure would have left every session suspended forever. That is why the caller changes in the same PR: with the error branch added, sessions are recreated on both outcomes.Net behavior:
clearDatafailure is now logged and no longer strands suspended sessions (previously an unhandled rejection).Follow-up (out of scope)
Implementing
clearDatafor real against Chromium'sBrowsingDataRemover, mappingWRuntime.ClearFlagsonto its data-type mask.Testing
./gradlew assembleNoapiArm64GeckoGenericDebug./gradlew testNoapiArm64GeckoGenericDebugUnitTest