Files
electron/shell
Samuel Attard 65e82ba6f1 fix: use the opener's session and webPreferences for windows opened from links (#55030)
fix: create windows opened from links natively in the opener's session

A window opened by middle- or modifier-clicking a link was assembled in JS
with `new BrowserWindow(options)` from a `-new-window` event, so it only got
whatever the options dict carried: it landed in the default session with
default webPreferences instead of inheriting from its opener the way a
window.open() popup does.

OpenURLFromTab now builds the child the same way a renderer-created popup is
built: `-will-add-new-contents` runs the app's window-open handler, the
content::WebContents is created in the opener's browser context with the
resulting preferences and starting sandbox flags, and it is handed to JS
through `-add-new-contents` with the navigation started as the initiating
document. The `-new-window` event, the guest-less branch of openGuestWindow
and the `openerSandboxFlags` webPreference are removed, and AddNewContents
reports a rejected window through `was_blocked` so neither caller navigates
it. `createWindow` now always receives `options.webContents`.
2026-10-16 00:54:36 -07:00
..