2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2025-01-24 07:38:36 +00:00

Fix #633 - "Copy Current URL" causing TypeError(#634)

When the `getCurrentUrl` function was refactored to make use of the `withFocusedWindow` function in ac99c6424d7326ad7d1da86922866e6776ce3220, it stopped returning a value and broke the "Copy Current URL" feature (#633).

This change restores the original behavior of the getCurrentURL function and makes the "Copy Current URL" feature functional again.
This commit is contained in:
David Kramer 2018-06-14 05:06:30 -07:00 committed by Ronan Jouchet
parent 0b47999c3e
commit c065cad01a

View File

@ -129,8 +129,9 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
const withFocusedWindow = (block) => { const withFocusedWindow = (block) => {
const focusedWindow = BrowserWindow.getFocusedWindow(); const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) { if (focusedWindow) {
block(focusedWindow); return block(focusedWindow);
} }
return undefined;
}; };
const adjustWindowZoom = (window, adjustment) => { const adjustWindowZoom = (window, adjustment) => {
@ -194,11 +195,8 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
}); });
}; };
const getCurrentUrl = () => { const getCurrentUrl = () =>
withFocusedWindow((focusedWindow) => { withFocusedWindow((focusedWindow) => focusedWindow.webContents.getURL());
focusedWindow.webContents.getURL();
});
};
const onWillNavigate = (event, urlToGo) => { const onWillNavigate = (event, urlToGo) => {
if (!linkIsInternal(options.targetUrl, urlToGo, options.internalUrls)) { if (!linkIsInternal(options.targetUrl, urlToGo, options.internalUrls)) {