Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
When obsolete, disable opening bookmarks
Browse files Browse the repository at this point in the history
This mainly prevents the bookmark bar actions, and stops short of disabling opening pages from the context menu of the bookmark page, to minimize risk of affecting normal webpage operations downloading the latest version of the browser
  • Loading branch information
petemill committed Apr 8, 2019
1 parent ec45aa8 commit bb15d4c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
10 changes: 6 additions & 4 deletions app/browser/reducers/tabsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const tabsReducer = (state, action, immutableAction) => {
break
}
case appConstants.APP_CREATE_TAB_REQUESTED:
if (action.getIn(['createProperties', 'fromCmdLine']) && getIsObsolete(state)) {
if (action.getIn(['createProperties', 'isObsoleteAction']) && getIsObsolete(state)) {
action = action.deleteIn(['createProperties', 'url'])
}
if (action.getIn(['createProperties', 'windowId']) == null) {
Expand Down Expand Up @@ -428,9 +428,11 @@ const tabsReducer = (state, action, immutableAction) => {
})
break
case appConstants.APP_LOAD_URL_REQUESTED:
setImmediate(() => {
tabs.loadURL(action)
})
if (!action.get('isObsoleteAction') || !getIsObsolete(state)) {
setImmediate(() => {
tabs.loadURL(action)
})
}
break
case appConstants.APP_LOAD_URL_IN_ACTIVE_TAB_REQUESTED:
setImmediate(() => {
Expand Down
2 changes: 1 addition & 1 deletion app/cmdLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const focusOrOpenWindow = function (url) {
if (url) {
const tabCreateProperties = {
url,
fromCmdLine: true
isObsoleteAction: true
}
// request to create tab in a new or existing window, and focus the window
appActions.createTabRequested(tabCreateProperties, false, false, true)
Expand Down
1 change: 1 addition & 0 deletions app/renderer/about/bookmarks/bookmarksList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BookmarksList extends ImmutableComponent {
e.preventDefault()
}
aboutActions.createTabRequested({
isObsoleteAction: true,
url: entry.location,
partitionNumber: entry.partitionNumber
})
Expand Down
6 changes: 6 additions & 0 deletions app/renderer/reducers/contextMenuReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const openInNewTabMenuItem = (url, partitionNumber, openerTabId) => {
url: sanitizeUrl(url[i]),
partitionNumber: partitionNumber[i],
openerTabId,
isObsoleteAction: true,
active
})
}
Expand All @@ -135,6 +136,7 @@ const openInNewTabMenuItem = (url, partitionNumber, openerTabId) => {
url: sanitizeUrl(url),
partitionNumber,
openerTabId,
isObsoleteAction: true,
active
})
}
Expand All @@ -154,6 +156,7 @@ const openInNewPrivateTabMenuItem = (url, openerTabId, isTor) => {
isPrivate: true,
isTor,
openerTabId,
isObsoleteAction: true,
active
})
}
Expand All @@ -168,6 +171,7 @@ const openInNewPrivateTabMenuItem = (url, openerTabId, isTor) => {
isPrivate: true,
isTor,
openerTabId,
isObsoleteAction: true,
active
})
}
Expand All @@ -186,6 +190,7 @@ const openInNewSessionTabMenuItem = (url, openerTabId) => {
url: sanitizeUrl(url[i]),
isPartitioned: true,
openerTabId,
isObsoleteAction: true,
active
})
}
Expand All @@ -199,6 +204,7 @@ const openInNewSessionTabMenuItem = (url, openerTabId) => {
url: sanitizeUrl(url),
isPartitioned: true,
openerTabId,
isObsoleteAction: true,
active
})
}
Expand Down
5 changes: 3 additions & 2 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,13 @@ const appActions = {
* @param {string} url - The url to load
* @param {boolean} reloadMatchingUrl - would you like to force reload provided tab
*/
loadURLRequested: function (tabId, url, reloadMatchingUrl) {
loadURLRequested: function (tabId, url, reloadMatchingUrl, isObsoleteAction) {
dispatch({
actionType: appConstants.APP_LOAD_URL_REQUESTED,
tabId,
url,
reloadMatchingUrl
reloadMatchingUrl,
isObsoleteAction
})
},

Expand Down
5 changes: 4 additions & 1 deletion js/actions/bookmarkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ const bookmarkActions = {
if (i <= 25) {
appActions.createTabRequested(
Object.assign(bookmarksUtil.toCreateProperties(bookmark), {
isObsoleteAction: true,
active: false
}), getSetting(SWITCH_TO_NEW_TABS))
} else {
appActions.createTabRequested({
url: bookmark.get('location'),
partitionNumber: bookmark.get('partitionNumber'),
isObsoleteAction: true,
discarded: true
}, false)
}
Expand All @@ -49,10 +51,11 @@ const bookmarkActions = {
appActions.createTabRequested({
url: bookmarkItem.get('location'),
partitionNumber: bookmarkItem.get('partitionNumber') || undefined,
isObsoleteAction: true,
active: !!e.shiftKey || getSetting(SWITCH_TO_NEW_TABS)
})
} else {
appActions.loadURLRequested(tabId, bookmarkItem.get('location'))
appActions.loadURLRequested(tabId, bookmarkItem.get('location'), undefined, true)
}

windowActions.setContextMenuDetail()
Expand Down

0 comments on commit bb15d4c

Please sign in to comment.