refactor: address TODO for WebContents type parsing (#18158)

This commit is contained in:
Milan Burda 2019-05-20 12:55:46 +02:00 committed by Alexey Kuzmin
parent 7e2cbf528e
commit 89105e7e57
6 changed files with 10 additions and 19 deletions

View file

@ -28,7 +28,7 @@ const mergeOptions = function (child, parent, visited) {
visited.add(parent)
for (const key in parent) {
if (key === 'isBrowserView') continue
if (key === 'type') continue
if (!hasProp.call(parent, key)) continue
if (key in child && key !== 'webPreferences') continue
@ -244,7 +244,7 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', functio
options = mergeBrowserWindowOptions(event.sender, options)
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer)
const { newGuest } = event
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
if ((event.sender.getType() === 'webview' && !event.sender.allowPopups) || event.defaultPrevented) {
if (newGuest != null) {
if (options.webContents === newGuest.webContents) {
// the webContents is not changed, so set defaultPrevented to false to