mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Set webPrereferences from features tring
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user