From 0620003b29a6e5733614027f7b84003ab50f4162 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Tue, 27 Mar 2018 19:49:55 +0200 Subject: [PATCH] Adds force load for load url Resolves #13584 Auditors: Test Plan: --- app/browser/tabs.js | 12 +++++++++--- .../components/preferences/payment/enabledContent.js | 3 ++- js/actions/appActions.js | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/browser/tabs.js b/app/browser/tabs.js index cbf86402c56..c1b6bc89f9a 100644 --- a/app/browser/tabs.js +++ b/app/browser/tabs.js @@ -860,11 +860,12 @@ const api = { const tabId = action.get('tabId') const tab = webContentsCache.getWebContents(tabId) if (tab && !tab.isDestroyed()) { - let url = normalizeUrl(action.get('url')) + const url = normalizeUrl(action.get('url')) + const currentUrl = tab.getURL() // We only allow loading URLs explicitly when the origin is // the same for pinned tabs. This is to help preserve a users // pins. - if (tab.pinned && getOrigin(tab.getURL()) !== getOrigin(url)) { + if (tab.pinned && getOrigin(currentUrl) !== getOrigin(url)) { api.create({ url, partition: tab.session.partition @@ -872,7 +873,12 @@ const api = { return } - tab.loadURL(url) + const reloadMatchingUrl = action.get('reloadMatchingUrl') || false + if (reloadMatchingUrl && currentUrl === url) { + tab.reload(true) + } else { + tab.loadURL(url) + } } }, diff --git a/app/renderer/components/preferences/payment/enabledContent.js b/app/renderer/components/preferences/payment/enabledContent.js index 7b37d2b2eae..1e15f96d07a 100644 --- a/app/renderer/components/preferences/payment/enabledContent.js +++ b/app/renderer/components/preferences/payment/enabledContent.js @@ -226,7 +226,8 @@ class EnabledContent extends ImmutableComponent { recoverStatusClick () { appActions.loadURLRequested( parseInt(this.props.ledgerData.get('tabId')), - 'about:preferences#payments?ledgerRecoveryOverlayVisible' + 'about:preferences#payments?ledgerRecoveryOverlayVisible', + true ) } diff --git a/js/actions/appActions.js b/js/actions/appActions.js index 898008bb437..e69aa97d59e 100644 --- a/js/actions/appActions.js +++ b/js/actions/appActions.js @@ -255,12 +255,14 @@ const appActions = { * A request for a URL load * @param {number} tabId - the tab ID to load the URL inside of * @param {string} url - The url to load + * @param {boolean} reloadMatchingUrl - would you like to force reload provided tab */ - loadURLRequested: function (tabId, url) { + loadURLRequested: function (tabId, url, reloadMatchingUrl) { dispatch({ actionType: appConstants.APP_LOAD_URL_REQUESTED, tabId, - url + url, + reloadMatchingUrl }) },