Updated required code to handle missing additional features for popup windows
This commit is contained in:
parent
ef88a06f08
commit
c811188e22
9 changed files with 35 additions and 17 deletions
|
@ -88,7 +88,7 @@ if (process.guestInstanceId == null) {
|
|||
|
||||
// Make the browser window or guest view emit "new-window" event.
|
||||
window.open = function (url, frameName, features) {
|
||||
var feature, guestId, i, j, len, len1, name, options, ref1, ref2, value
|
||||
var feature, guestId, i, j, len, len1, name, options, ref1, ref2, value, additionalFeatures
|
||||
if (frameName == null) {
|
||||
frameName = ''
|
||||
}
|
||||
|
@ -101,6 +101,9 @@ window.open = function (url, frameName, features) {
|
|||
const webPreferences = ['zoomFactor', 'nodeIntegration', 'preload']
|
||||
const disposition = 'new-window'
|
||||
|
||||
// Used to store additional features
|
||||
additionalFeatures = []
|
||||
|
||||
// Make sure to get rid of excessive whitespace in the property name
|
||||
ref1 = features.split(/,\s*/)
|
||||
for (i = 0, len = ref1.length; i < len; i++) {
|
||||
|
@ -109,13 +112,17 @@ window.open = function (url, frameName, features) {
|
|||
name = ref2[0]
|
||||
value = ref2[1]
|
||||
value = value === 'yes' || value === '1' ? true : value === 'no' || value === '0' ? false : value
|
||||
if (webPreferences.includes(name)) {
|
||||
if (options.webPreferences == null) {
|
||||
options.webPreferences = {}
|
||||
}
|
||||
options.webPreferences[name] = value
|
||||
if (value === undefined) {
|
||||
additionalFeatures.push(feature)
|
||||
} else {
|
||||
options[name] = value
|
||||
if (webPreferences.includes(name)) {
|
||||
if (options.webPreferences == null) {
|
||||
options.webPreferences = {}
|
||||
}
|
||||
options.webPreferences[name] = value
|
||||
} else {
|
||||
options[name] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.left) {
|
||||
|
@ -150,7 +157,7 @@ window.open = function (url, frameName, features) {
|
|||
options[name] = parseInt(options[name], 10)
|
||||
}
|
||||
}
|
||||
guestId = ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, disposition, options)
|
||||
guestId = ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, disposition, options, additionalFeatures)
|
||||
if (guestId) {
|
||||
return BrowserWindowProxy.getOrCreate(guestId)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue