Two key points should help you with your problems.
1) chrome.browserAction.setBadgeText has an optional tabId parameter that binds the value to the tab.
2) You must filter the chrome.tabs.onUpdated changeInfo fields events.
So change your code to:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){ function(tabId, changeInfo, tab){ if(!changeInfo.url) return;
This may not cause the creation of new tabs; if not, also listen onCreated
source share