Skip to content

Commit

Permalink
Adds force load for load url
Browse files Browse the repository at this point in the history
Resolves brave#13584

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Mar 27, 2018
1 parent f482935 commit 0620003
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
12 changes: 9 additions & 3 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,19 +860,25 @@ 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
})
return
}

tab.loadURL(url)
const reloadMatchingUrl = action.get('reloadMatchingUrl') || false
if (reloadMatchingUrl && currentUrl === url) {
tab.reload(true)
} else {
tab.loadURL(url)
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down
6 changes: 4 additions & 2 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
},

Expand Down

0 comments on commit 0620003

Please sign in to comment.