Skip to content
Browse files

Fix the bug of reload looping

  • Loading branch information...
1 parent e009718 commit 232f42149e25204a4928d4303fdcc6422262fcfd @jason2506 jason2506 committed Oct 21, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 extension/scripts/background.js
View
13 extension/scripts/background.js
@@ -7,15 +7,16 @@
// }
// });
// });
-var original_tab_url = ''
-function checkForValidUrl(tabId, changeInfo, tab) {
- if (tab.url != original_tab_url){
- if (tab.url.indexOf('www.facebook.com/pages/') > -1 || tab.url.indexOf('www.facebook.com/events/') > -1){
+var original_tab_url = {};
+var checkForValidUrl = function (tabId, changeInfo, tab) {
+ if (tab.url != original_tab_url[tabId]) {
+ if (tab.url.indexOf('www.facebook.com/pages/') > -1 ||
+ tab.url.indexOf('www.facebook.com/events/') > -1) {
chrome.tabs.reload(tab.id);
}
- original_tab_url = tab.url;
+ original_tab_url[tabId] = tab.url;
}
-};
+}
chrome.tabs.onUpdated.addListener(checkForValidUrl);

0 comments on commit 232f421

Please sign in to comment.
Something went wrong with that request. Please try again.