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

When the `getCurrentUrl` function was refactored to make use of the `withFocusedWindow` function in ac99c6424d, 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
1 changed files with 4 additions and 6 deletions

View File

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