Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ThrDev
2020-04-26 19:29:39 -04:00
3 changed files with 8 additions and 23 deletions

View File

@@ -161,17 +161,11 @@ module.exports = (socket, app) => {
electronSocket.emit('browserWindow-new-window-for-tab' + id);
});
});
function hasOwnChildreen(obj, ...childNames) {
for (let i = 0; i < childNames.length; i++) {
if (!obj || !obj.hasOwnProperty(childNames[i])) {
return false;
}
obj = obj[childNames[i]];
}
return true;
}
socket.on('createBrowserWindow', (options, loadUrl) => {
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true } };
}
else if (!options.webPreferences) {
options = { ...options, webPreferences: { nodeIntegration: true } };
}
window = new electron_1.BrowserWindow(options);

File diff suppressed because one or more lines are too long

View File

@@ -192,19 +192,10 @@ export = (socket: SocketIO.Socket, app: Electron.App) => {
});
});
function hasOwnChildreen(obj, ...childNames) {
for (let i = 0; i < childNames.length; i++) {
if (!obj || !obj.hasOwnProperty(childNames[i])) {
return false;
}
obj = obj[childNames[i]];
}
return true;
}
socket.on('createBrowserWindow', (options, loadUrl) => {
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true } };
} else if (!options.webPreferences) {
options = { ...options, webPreferences: { nodeIntegration: true } };
}