Skip to content

Commit e8c5888

Browse files
authored
popupconfig: adjust to new-window event replacement (#310)
1 parent 0568761 commit e8c5888

File tree

1 file changed

+5
-33
lines changed

1 file changed

+5
-33
lines changed

popupsconfig/main.js

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const electron = require('electron');
2-
const { BrowserWindow } = electron;
31
const popupsConfigRegistry = require('./PopupsConfigRegistry');
42
const { testMatchPatterns } = require('./functions');
53
const { popupConfigs } = require('./constants');
@@ -14,47 +12,21 @@ function initPopupsConfiguration(jitsiMeetWindow) {
1412
popupsConfigRegistry.registerPopupConfigs(popupConfigs);
1513

1614
// Configuration for the google auth popup.
17-
jitsiMeetWindow.webContents.on('new-window', (
18-
event,
19-
url,
20-
frameName,
21-
disposition,
22-
options) => {
15+
jitsiMeetWindow.webContents.setWindowOpenHandler(({url, frameName}) => {
2316
const configGoogle
2417
= popupsConfigRegistry.getConfigByName('google-auth') || {};
2518
if (testMatchPatterns(url, frameName, configGoogle.matchPatterns)) {
26-
event.preventDefault();
27-
event.newGuest = new BrowserWindow(Object.assign(options, {
28-
titleBarStyle: undefined,
29-
webPreferences: {
30-
contextIsolation: true,
31-
enableBlinkFeatures: undefined,
32-
enableRemoteModule: false,
33-
nodeIntegration: false,
34-
preload: false,
35-
webSecurity: true
36-
}
37-
}));
19+
return { action: 'allow' };
3820
}
3921

4022
const configDropbox
4123
= popupsConfigRegistry.getConfigByName('dropbox-auth') || {};
4224

4325
if (testMatchPatterns(url, frameName, configDropbox.matchPatterns)) {
44-
event.preventDefault();
45-
event.newGuest = new BrowserWindow(Object.assign(options, {
46-
titleBarStyle: undefined,
47-
webPreferences: {
48-
contextIsolation: true,
49-
enableBlinkFeatures: undefined,
50-
enableRemoteModule: false,
51-
nodeIntegration: false,
52-
preload: false,
53-
webSecurity: true,
54-
sandbox: true
55-
}
56-
}));
26+
return { action: 'allow' };
5727
}
28+
29+
return { action: 'deny' };
5830
});
5931
}
6032

0 commit comments

Comments
 (0)