lib/browser/guest-window-manager.js
function (embedder, options) {
  if (options.webPreferences == null) {
    options.webPreferences = {}
  }
  if (embedder.browserWindowOptions != null) {
    let parentOptions = embedder.browserWindowOptions

    // if parent's visibility is available, that overrides 'show' flag (#12125)
    const win = BrowserWindow.fromWebContents(embedder.webContents)
    if (win != null) {
      parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() }
    }

    // Inherit the original options if it is a BrowserWindow.
    mergeOptions(options, parentOptions)
  } else {
    // Or only inherit webPreferences if it is a webview.
    mergeOptions(options.webPreferences, embedder.getLastWebPreferences())
  }

  // Inherit certain option values from parent window
  const webPreferences = embedder.getLastWebPreferences()
  for (const [name, value] of inheritedWebPreferences) {
    if (webPreferences[name] === value) {
      options.webPreferences[name] = value
    }
  }

  // Sets correct openerId here to give correct options to 'new-window' event handler
  options.webPreferences.openerId = embedder.id

  return options
}
function (embedder, options) {
  if (options.webPreferences == null) {
    options.webPreferences = {}
  }
  if (embedder.browserWindowOptions != null) {
    let parentOptions = embedder.browserWindowOptions

    // if parent's visibility is available, that overrides 'show' flag (#12125)
    const win = BrowserWindow.fromWebContents(embedder.webContents)
    if (win != null) {
      parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() }
    }

    // Inherit the original options if it is a BrowserWindow.
    mergeOptions(options, parentOptions)
  } else {
    // Or only inherit webPreferences if it is a webview.
    mergeOptions(options.webPreferences, embedder.getLastWebPreferences())
  }

  // Inherit certain option values from parent window
  const webPreferences = embedder.getLastWebPreferences()
  for (const [name, value] of inheritedWebPreferences) {
    if (webPreferences[name] === value) {
      options.webPreferences[name] = value
    }
  }

  // Sets correct openerId here to give correct options to 'new-window' event handler
  options.webPreferences.openerId = embedder.id

  return options
}
function ( embedder , options ) { if ( options . webPreferences == null ) { options . webPreferences = { } } if ( embedder . browserWindowOptions != null ) { let parentOptions = embedder . browserWindowOptions // if parent's visibility is available, that overrides 'show' flag (#12125) const win = BrowserWindow . fromWebContents ( embedder . webContents ) if ( win != null ) { parentOptions = { ... embedder . browserWindowOptions , show : win . isVisible ( ) } } // Inherit the original options if it is a BrowserWindow. mergeOptions ( options , parentOptions ) } else { // Or only inherit webPreferences if it is a webview. mergeOptions ( options . webPreferences , embedder . getLastWebPreferences ( ) ) } // Inherit certain option values from parent window const webPreferences = embedder . getLastWebPreferences ( ) for ( const [ name , value ] of inheritedWebPreferences ) { if ( webPreferences [ name ] === value ) { options . webPreferences [ name ] = value } } // Sets correct openerId here to give correct options to 'new-window' event handler options . webPreferences . openerId = embedder . id return options }
Merge |options| with the |embedder|'s window's options.
Merge |options| with the |embedder| s window s options .