lib/browser/guest-window-manager.js
function (embedder, url, referrer, frameName, options, postData) {
  let guest = frameToGuest.get(frameName)
  if (frameName && (guest != null)) {
    guest.loadURL(url)
    return guest.webContents.id
  }

  // Remember the embedder window's id.
  if (options.webPreferences == null) {
    options.webPreferences = {}
  }

  guest = new BrowserWindow(options)
  if (!options.webContents) {
    // We should not call `loadURL` if the window was constructed from an
    // existing webContents (window.open in a sandboxed renderer).
    //
    // Navigating to the url when creating the window from an existing
    // webContents is not necessary (it will navigate there anyway).
    const loadOptions = {
      httpReferrer: referrer
    }
    if (postData != null) {
      loadOptions.postData = postData
      loadOptions.extraHeaders = 'content-type: application/x-www-form-urlencoded'
      if (postData.length > 0) {
        const postDataFront = postData[0].bytes.toString()
        const boundary = /^--.*[^-\r\n]/.exec(postDataFront)
        if (boundary != null) {
          loadOptions.extraHeaders = `content-type: multipart/form-data; boundary=${boundary[0].substr(2)}`
        }
      }
    }
    guest.loadURL(url, loadOptions)
  }

  return setupGuest(embedder, frameName, guest, options)
}
function (embedder, url, referrer, frameName, options, postData) {
  let guest = frameToGuest.get(frameName)
  if (frameName && (guest != null)) {
    guest.loadURL(url)
    return guest.webContents.id
  }

  // Remember the embedder window's id.
  if (options.webPreferences == null) {
    options.webPreferences = {}
  }

  guest = new BrowserWindow(options)
  if (!options.webContents) {
    // We should not call `loadURL` if the window was constructed from an
    // existing webContents (window.open in a sandboxed renderer).
    //
    // Navigating to the url when creating the window from an existing
    // webContents is not necessary (it will navigate there anyway).
    const loadOptions = {
      httpReferrer: referrer
    }
    if (postData != null) {
      loadOptions.postData = postData
      loadOptions.extraHeaders = 'content-type: application/x-www-form-urlencoded'
      if (postData.length > 0) {
        const postDataFront = postData[0].bytes.toString()
        const boundary = /^--.*[^-\r\n]/.exec(postDataFront)
        if (boundary != null) {
          loadOptions.extraHeaders = `content-type: multipart/form-data; boundary=${boundary[0].substr(2)}`
        }
      }
    }
    guest.loadURL(url, loadOptions)
  }

  return setupGuest(embedder, frameName, guest, options)
}
function ( embedder , url , referrer , frameName , options , postData ) { let guest = frameToGuest . get ( frameName ) if ( frameName && ( guest != null ) ) { guest . loadURL ( url ) return guest . webContents . id } // Remember the embedder window's id. if ( options . webPreferences == null ) { options . webPreferences = { } } guest = new BrowserWindow ( options ) if ( ! options . webContents ) { // We should not call `loadURL` if the window was constructed from an // existing webContents (window.open in a sandboxed renderer). // // Navigating to the url when creating the window from an existing // webContents is not necessary (it will navigate there anyway). const loadOptions = { httpReferrer : referrer } if ( postData != null ) { loadOptions . postData = postData loadOptions . extraHeaders = 'content-type: application/x-www-form-urlencoded' if ( postData . length > 0 ) { const postDataFront = postData [ 0 ] . bytes . toString ( ) const boundary = / ^--.*[^-\r\n] / . exec ( postDataFront ) if ( boundary != null ) { loadOptions . extraHeaders = ` ${ boundary [ 0 ] . substr ( 2 ) } ` } } } guest . loadURL ( url , loadOptions ) } return setupGuest ( embedder , frameName , guest , options ) }
Create a new guest created by |embedder| with |options|.
Create a new guest created by |embedder| with |options| .