Skip to content

Commit eee6ffc

Browse files
committed
fix missing favicon's
1 parent bbc5213 commit eee6ffc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"activeTab",
2121
"storage",
2222
"idle",
23-
"chrome://favicon/*"
23+
"chrome://favicon/*",
24+
"webNavigation"
2425
],
2526
"background": {
2627
"scripts": ["scripts/common.js",

scripts/activity.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,14 @@ class Activity {
5555
loadDataFromStorage(){
5656
var tabs = storage.load(STORAGE_TABS);
5757
}
58+
59+
updateFavicon(tab){
60+
var domain = this.extractHostname(tab.url);
61+
var currentTab = this.getTab(domain);
62+
if (currentTab !== null && currentTab !== undefined){
63+
if (tab.favIconUrl !== undefined && tab.favIconUrl !== currentTab.favicon){
64+
currentTab.favicon = tab.favIconUrl;
65+
}
66+
}
67+
}
5868
};

scripts/background.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ function addListener() {
5050
activity.addTab(tab);
5151
});
5252
});
53+
54+
chrome.webNavigation.onCompleted.addListener(function(details){
55+
chrome.tabs.get(details.tabId, function (tab) {
56+
activity.updateFavicon(tab);
57+
});
58+
});
5359
}
5460

5561
addListener();

0 commit comments

Comments
 (0)