aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Balaji Vijayakumar <kuttibalaji.v6@gmail.com>2022-12-08 16:30:36 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-12-08 20:35:31 +0530
commit3ecc7aa2e5263e15e140cc7380194ad065af8a1c (patch)
treefbb015e17214df1aa2e0d58b2dfcf26072ec4540 /src
parent6.2.3-nightly.2 [skip ci] (diff)
downloadferdium-app-3ecc7aa2e5263e15e140cc7380194ad065af8a1c.tar.gz
ferdium-app-3ecc7aa2e5263e15e140cc7380194ad065af8a1c.tar.zst
ferdium-app-3ecc7aa2e5263e15e140cc7380194ad065af8a1c.zip
Backported deprecation fixes from electron v22 upgrade
Diffstat (limited to 'src')
-rw-r--r--src/index.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/index.ts b/src/index.ts
index 0efd0437d..ac166c5f1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -233,8 +233,9 @@ const createWindow = () => {
233 app.on('web-contents-created', (_e, contents) => { 233 app.on('web-contents-created', (_e, contents) => {
234 if (contents.getType() === 'webview') { 234 if (contents.getType() === 'webview') {
235 enableWebContents(contents); 235 enableWebContents(contents);
236 contents.on('new-window', event => { 236 contents.setWindowOpenHandler(({ url }) => {
237 event.preventDefault(); 237 openExternalUrl(url);
238 return { action: 'deny' };
238 }); 239 });
239 } 240 }
240 }); 241 });
@@ -397,9 +398,9 @@ const createWindow = () => {
397 // @ts-expect-error Property 'isMaximized' does not exist on type 'App'. 398 // @ts-expect-error Property 'isMaximized' does not exist on type 'App'.
398 app.isMaximized = mainWindow.isMaximized(); 399 app.isMaximized = mainWindow.isMaximized();
399 400
400 mainWindow.webContents.on('new-window', (e, url) => { 401 mainWindow.webContents.setWindowOpenHandler(({ url }) => {
401 e.preventDefault();
402 openExternalUrl(url); 402 openExternalUrl(url);
403 return { action: 'deny' };
403 }); 404 });
404 405
405 if ( 406 if (
@@ -718,9 +719,9 @@ app.on('activate', () => {
718}); 719});
719 720
720app.on('web-contents-created', (_createdEvent, contents) => { 721app.on('web-contents-created', (_createdEvent, contents) => {
721 contents.on('new-window', (event, _url, _frameNme, disposition) => { 722 contents.setWindowOpenHandler(({ disposition }) =>
722 if (disposition === 'foreground-tab') event.preventDefault(); 723 disposition === 'foreground-tab' ? { action: 'deny' } : { action: 'allow' },
723 }); 724 );
724}); 725});
725 726
726app.on('will-finish-launching', () => { 727app.on('will-finish-launching', () => {