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

Commit

Permalink
Update favicon from importer
Browse files Browse the repository at this point in the history
fix #4720

Auditors: @bbondy

Test Plan:
1. Make sure "Favicons" in "about:preferences#general" is on
2. Import bookmarks from other browser or html file
3. There should be favicon for bookmarks
  • Loading branch information
darkdh committed Sep 24, 2016
1 parent bbf5fc9 commit ce89a34
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@ importer.on('add-bookmarks', (e, bookmarks, topLevelFolder) => {
})

importer.on('add-favicons', (e, detail) => {
let faviconMap = {}
detail.forEach((entry) => {
faviconMap[entry.urls[0]] = entry.favicon_url
})
let sites = AppStore.getState().get('sites')
sites = sites.map((site) => {
if (site.get('favicon') === undefined && site.get('location') !== undefined &&
faviconMap[site.get('location')] !== undefined) {
return site.set('favicon', faviconMap[site.get('location')])
} else {
return site
}
})
appActions.addSite(sites)
})

importer.on('add-keywords', (e, templateUrls, uniqueOnHostAndPath) => {
Expand Down

0 comments on commit ce89a34

Please sign in to comment.