mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
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.