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

Commit

Permalink
Disable search suggestions in private mode for Tor
Browse files Browse the repository at this point in the history
Fix #13064
  • Loading branch information
diracdeltas committed Feb 20, 2018
1 parent 88b2075 commit 64236ef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/common/lib/suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ const sigmoid = (t) => {

const ONE_DAY = 1000 * 60 * 60 * 24

const searchSuggestionsEnabled = (state, tabId) => {
const frame = getFrameByTabId(state, tabId)
if (!frame || frame.get('isPrivate')) {
return false
}
return getSetting(settings.OFFER_SEARCH_SUGGESTIONS)
}

/*
* Calculate the sorting priority for a history item based on number of
* accesses and time since last access
Expand Down Expand Up @@ -564,7 +572,7 @@ const getSearchSuggestions = (state, tabId, urlLocationLower) => {
return new Promise((resolve, reject) => {
const mapListToElements = getMapListToElements(urlLocationLower)
let suggestionsList = Immutable.List()
if (getSetting(settings.OFFER_SEARCH_SUGGESTIONS)) {
if (searchSuggestionsEnabled(state, tabId)) {
const searchResults = state.get('searchResults')
const sortHandler = getSortForSearchSuggestions(urlLocationLower)
if (searchResults) {
Expand Down Expand Up @@ -630,7 +638,7 @@ const generateNewSearchXHRResults = debounce((state, windowId, tabId, input) =>
? frameSearchDetail.get('autocomplete')
: searchDetail.get('autocompleteURL')

const shouldDoSearchSuggestions = getSetting(settings.OFFER_SEARCH_SUGGESTIONS) &&
const shouldDoSearchSuggestions = searchSuggestionsEnabled(state, tabId) &&
autocompleteURL &&
!isUrl(input) &&
input.length !== 0
Expand Down

0 comments on commit 64236ef

Please sign in to comment.