Set webPrereferences from features tring
This commit is contained in:
parent
2acfb8ad82
commit
a14380ed01
1 changed files with 10 additions and 1 deletions
|
@ -101,6 +101,7 @@ window.open = function(url, frameName, features) {
|
|||
}
|
||||
options = {};
|
||||
ints = ['x', 'y', 'width', 'height', 'min-width', 'max-width', 'min-height', 'max-height', 'zoom-factor'];
|
||||
const webPreferences = ['zoom-factor', 'zoomFactor', 'node-integration', 'nodeIntegration', 'preload'];
|
||||
|
||||
// Make sure to get rid of excessive whitespace in the property name
|
||||
ref1 = features.split(/,\s*/);
|
||||
|
@ -109,7 +110,15 @@ window.open = function(url, frameName, features) {
|
|||
ref2 = feature.split(/\s*=/);
|
||||
name = ref2[0];
|
||||
value = ref2[1];
|
||||
options[name] = value === 'yes' || value === '1' ? true : value === 'no' || value === '0' ? false : value;
|
||||
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;
|
||||
} else {
|
||||
options[name] = value;
|
||||
}
|
||||
}
|
||||
if (options.left) {
|
||||
if (options.x == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue