Files
electron/shell
Keeley Hammond 58d6da6b16 fix: only bind ElectronAutofillDriver on primary main frames
The `mojom::ElectronAutofillDriver` associated interface was being
registered for every `RenderFrameHost`, and `AutofillDriverFactory`
would create a driver for any live frame. In practice the native
autofill popup is only exercised from `<datalist>` / `<select>`
elements on the primary main frame — the autofill spec even notes
that `webContents.sendInputEvent` cannot route keyboard input to an
OOPIF, so subframes have no working path to this UI.

Scope the interface to where it is actually used:

* Gate the associated registry entry in
  `ElectronBrowserClient::RegisterAssociatedInterfaceBindersForRenderFrameHost`
  on `IsInPrimaryMainFrame()`, mirroring how `ElectronApiIPC` is
  already scoped in the same function.
* Return early from `AutofillDriverFactory::DriverForFrame` for any
  non-primary-main-frame RFH so the factory never stores a driver
  for an unsupported frame.
* Re-check `IsInPrimaryMainFrame()` inside
  `AutofillDriver::ShowAutofillPopup` as defense in depth for
  messages that race with a navigation.
2026-04-11 20:06:34 -07:00
..