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

Commit

Permalink
Remove Brave software links from urlbar suggestions
Browse files Browse the repository at this point in the history
fix #7655

Auditors: @bsclifton

Test Plan:
1. open a clean instance of brave
2. type 'face' into the urlbar
3. it should autocomplete to facebook instead of Brave's facebook page
  • Loading branch information
diracdeltas committed Mar 14, 2017
1 parent 641bc0a commit d4ceece
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 1 addition & 15 deletions app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ const getSetting = require('../js/settings').getSetting
const promisify = require('../js/lib/promisify')
const sessionStorageName = `session-store-${sessionStorageVersion}`

const getTopSiteMap = () => {
if (Array.isArray(topSites) && topSites.length) {
let siteMap = {}
let order = 0
topSites.forEach((site) => {
let key = siteUtil.getSiteKey(Immutable.fromJS(site))
site.order = order++
siteMap[key] = site
})
return siteMap
}
return {}
}

const getStoragePath = () => {
return path.join(app.getPath('userData'), sessionStorageName)
}
Expand Down Expand Up @@ -524,7 +510,7 @@ module.exports.defaultAppState = () => {
sync: {
lastFetchTimestamp: 0
},
sites: getTopSiteMap(),
sites: {},
tabs: [],
windows: [],
extensions: {},
Expand Down
2 changes: 2 additions & 0 deletions js/data/newTabData.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ module.exports.topSites = [
"title": "Brave Browser: Fast AdBlock – Apps para Android no Google Play"
}
]

module.exports.topSiteLocations = module.exports.topSites.map((site) => site.location)
14 changes: 13 additions & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Filtering = require('../../app/filtering')
const basicAuth = require('../../app/browser/basicAuth')
const webtorrent = require('../../app/browser/webtorrent')
const windows = require('../../app/browser/windows')
const { topSiteLocations } = require('../data/newTabData')
const assert = require('assert')

// state helpers
Expand Down Expand Up @@ -421,9 +422,20 @@ const handleAppAction = (action) => {
appState = appState.set('passwords', new Immutable.List())
break
case appConstants.APP_CHANGE_NEW_TAB_DETAIL:
// If a site is pinned, add it to the sites if it isn't already there.
if (action.newTabPageDetail) {
let pinnedTopSites = action.newTabPageDetail.get('pinnedTopSites')
if (pinnedTopSites) {
pinnedTopSites.forEach((site) => {
if (site && topSiteLocations.includes(site.get('location'))) {
appState = appState.set('sites', siteUtil.addSite(appState.get('sites'), site))
}
})
}
}
appState = aboutNewTabState.mergeDetails(appState, action)
if (action.refresh) {
appState = aboutNewTabState.setSites(appState, action)
appState = aboutNewTabState.setSites(appState)
}
break
case appConstants.APP_POPULATE_HISTORY:
Expand Down

0 comments on commit d4ceece

Please sign in to comment.