Conversation
- 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.
Bundle size change (main vs. current)autofill.js: 787.50 KB -> 787.67 KB |
|
|
||
| if (typeof window.BrowserAutofill === 'undefined') { | ||
| return; | ||
| } |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
@cursoragent I think this is fine, we alternatively could move this check up outside of the message handler to make it much safer.
There was a problem hiding this comment.
@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
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>




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.BrowserAutofillbridge is unavailable.AndroidTransportnow caches the bridge asthis.autofillBridge, uses it for all bridge invocations, and bails out early insend()when it’s missing; the builtdist/autofill.jsanddist/autofill-debug.jsbundles are updated accordingly.Written by Cursor Bugbot for commit fee89eb. This will update automatically on new commits. Configure here.