From 04b52afc6bd2de62c991a6bef3c185be8697bcca Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 2 Oct 2019 17:56:02 +0200 Subject: Fixes #1609 by adding special handling for skype links --- src/webview/recipe.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index c223b73de..60660d8f1 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -32,7 +32,7 @@ class RecipeController { 'settings-update': 'updateAppSettings', 'service-settings-update': 'updateServiceSettings', 'get-service-id': 'serviceIdEcho', - } + }; constructor() { this.initialize(); @@ -174,6 +174,32 @@ new RecipeController(); const originalWindowOpen = window.open; window.open = (url, frameName, features) => { + if (!url && !frameName && !features) { + // The service hasn't yet supplied a URL (as used in Skype). + // Return a new dummy window object and wait for the service to change the properties + const newWindow = { + location: { + href: '', + }, + }; + + const checkInterval = setInterval(() => { + // Has the service changed the URL yet? + if (newWindow.location.href !== '') { + // Open the new URL + ipcRenderer.sendToHost('new-window', newWindow.location.href); + clearInterval(checkInterval); + } + }, 0); + + setTimeout(() => { + // Stop checking for location changes after 1 second + clearInterval(checkInterval); + }, 1000); + + return newWindow; + } + // We need to differentiate if the link should be opened in a popup or in the systems default browser if (!frameName && !features) { return ipcRenderer.sendToHost('new-window', url); -- cgit v1.2.3-54-g00ecf