Skip to content

Android error management audit fixes#925

Open
jonathanKingston wants to merge 4 commits intomainfrom
jkt/auto/error-management-audit-fixes-e6de
Open

Android error management audit fixes#925
jonathanKingston wants to merge 4 commits intomainfrom
jkt/auto/error-management-audit-fixes-e6de

Conversation

@jonathanKingston
Copy link
Collaborator

@jonathanKingston jonathanKingston commented Feb 6, 2026

Reviewer: @dbajpeyi
Asana: https://app.asana.com/1/137249556945/task/1213139946120169

Description

Bail out early on Android for this edge case that shouldn't really happen.

Steps to test


Note

Low Risk
Small defensive change that only alters behavior in an unexpected edge case (missing Android bridge) and otherwise keeps call routing the same.

Overview
Prevents Android device API calls from throwing when the native window.BrowserAutofill bridge is unavailable.

AndroidTransport now caches the bridge as this.autofillBridge, uses it for all bridge invocations, and bails out early in send() when it’s missing; the built dist/autofill.js and dist/autofill-debug.js bundles are updated accordingly.

Written by Cursor Bugbot for commit fee89eb. This will update automatically on new commits. Configure here.

- Add explanatory comments to empty catch blocks in InterfacePrototype.js
  setupAutofill() for getUserData and getEmailProtectionCapabilities
- Add typeof guard for window.BrowserAutofill in android.transport.js
  to prevent TypeError when bridge is not attached or WebView is being destroyed
Revert comment-only changes in InterfacePrototype.js.
Change android.transport.js guard to silently return when bridge
is unavailable instead of throwing.
@jonathanKingston jonathanKingston changed the title Jkt/auto/error management audit fixes e6de Andriud error management audit fixes Feb 6, 2026
@jonathanKingston jonathanKingston changed the title Andriud error management audit fixes Android error management audit fixes Feb 6, 2026
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

bundle-size-check
node scripts/bundle-size-check.js

Bundle size change (main vs. current)

autofill.js: 787.50 KB -> 787.67 KB
Change: +179.00 B (+0.02%)


autofill-debug.js: 937.46 KB -> 937.63 KB
Change: +179.00 B (+0.02%)

Copy link

@cursor cursor bot left a comment

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.


if (typeof window.BrowserAutofill === 'undefined') {
return;
}
Copy link

Choose a reason for hiding this comment

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

Silent failure for operations when BrowserAutofill unavailable

Low Severity

When window.BrowserAutofill is undefined, returning undefined causes operations like StoreFormDataCall and SetIncontextSignupPermanentlyDismissedAtCall to silently fail. These are called via notify() which doesn't validate results, so the caller has no indication the operation didn't execute. Previously, this would throw a TypeError, making the failure visible. Silent data loss on StoreFormDataCall could be particularly problematic, even if this edge case "shouldn't really happen."

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cursoragent I think this is fine, we alternatively could move this check up outside of the message handler to make it much safer.

Copy link

Choose a reason for hiding this comment

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

Taking a look!

Open in Cursor Open in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cursoragent you also need to run npm ci and npm build and checking the two files from the test fail:

dist/autofill-debug.js: needs update
dist/autofill.js: needs update

Copy link

@cursor cursor bot Feb 6, 2026

Choose a reason for hiding this comment

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

Rebuilt the dist files and pushed. Ran npm ci, npm run build, verified both dist/autofill.js and dist/autofill-debug.js were updated, and confirmed all tests + lint pass before committing.

Open in Cursor Open in Web

cursoragent and others added 2 commits February 6, 2026 22:04
Capture window.BrowserAutofill as this.autofillBridge in the
constructor, moving the bridge resolution outside the send handler.
All bridge calls in send() now use the stored reference instead of
accessing window.BrowserAutofill repeatedly.

Co-authored-by: Jonathan Kingston <jonathanKingston@users.noreply.github.com>
Co-authored-by: Jonathan Kingston <jonathanKingston@users.noreply.github.com>
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.

2 participants