hosts = [
  'googleadservices',
  'googlesyndication',
  'a2dfp',
  'ad6media',
  'adbrite',
  'adcash',
  'adknowledge',
  'adnext',
  'adnxs',
  'adsdk',
  'atdmt',
  'atwola',
  'bfast',
  'beead',
  'criteo',
  'ezakus',
  'falkag',
  'himediads',
  'infolinks',
  'kameleoon',
  'ligatus',
  'outbrain',
  'qksrv',
  'skimresources',
  'tradedoubler',
  'tradelab',
  'visualrevenue',
  'doubleclick',
  'blogads',
  'click-fr',
  'ebz.io',
  'edi7',
  'eficiens-',
  'media-clic',
  'netavenir',
  'piximedia',
  'promobenef',
  'pubdirecte',
  'rentabiliweb',
  'sascdn.com',
  'adverpub',
  'deltapub',
  'gestionpub',
  'manchettepub',
  'regiedepub',
  'regypub',
  'storpub',
  'clickthru',
  'taboola',
  'smartadserver.com',
  'r66net.com',
  'videostep.com',
  'scorecardresearch.com',
  'exoclick.com',
];

var tabs = {};

//Init tabs
chrome.tabs.query({}, function(allTabs) {
  for (var i=0; i<allTabs.length; i++) {
    var tab = allTabs[i];
    if (tabs[tab.id] == undefined) {
      tabs[tab.id] = {'block':true, 'url':tab.url, 'count':0};
    };
  }
});

//Update tabs
chrome.tabs.onActivated.addListener(function(activeInfo) {
  chrome.tabs.get(activeInfo.tabId, function (tab) {
    if (tabs[tab.id] == undefined) {
      tabs[tab.id] = {'block':true, 'url':tab.url, 'count':0};
    };
    if (tabs[tab.id]['block']) {
      chrome.browserAction.setIcon({path: "plock.png"});
    } else {
      chrome.browserAction.setIcon({path: "plock_ok.png"});
    }
  });
});

//Update tabs url
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, updatedTab) {
    if (changeInfo.url != undefined) {
      tabs[tabId]['url'] = changeInfo.url;
      tabs[tabId]['count'] = 0;
      updateBadge();
    }
});

//Update tabs block
chrome.browserAction.onClicked.addListener(function(tab) {
  if (tabs[tab.id]['block']) {
    tabs[tab.id]['block'] = false;
    chrome.browserAction.setIcon({path: "plock_ok.png"});
  } else {
    tabs[tab.id]['block'] = true;
    chrome.browserAction.setIcon({path: "plock.png"});
  }
  chrome.tabs.reload(tab.id);
});

//block request if needed
var block = function(details) {
  if (tabs[details.tabId] != undefined && tabs[details.tabId]['block']) {
    var parser = document.createElement('a');
    parser.href = details.url;
    for (var i=0; i<hosts.length; i++) {
      if (parser.hostname.indexOf(hosts[i]) != -1) {
        tabs[details.tabId]['count']++;
        updateBadge();
        return {cancel:true};
      }
    }
    return {};
  }
}

//Listen request
chrome.webRequest.onBeforeRequest.addListener(
  block,
  {urls: ["<all_urls>"]},
  ["blocking"]);

//Update icon badge
function updateBadge() {
  chrome.tabs.query({'active': true}, function(allTabs) {
    var tab = allTabs[0];
    if (tabs[tab.id]['count']>0) {
      chrome.browserAction.setBadgeBackgroundColor({color:[255, 0, 0, 255], tabId:tab.id});
      chrome.browserAction.setBadgeText({text: ""+tabs[tab.id]['count'], tabId:tab.id});
    } else {
      chrome.browserAction.setBadgeText({text: "", tabId:tab.id});
    }
  });
}
@@ -1597,29 +1597,182 @@
 Info
-.url != undefined) %7B%0A
+ != undefined && changeInfo.url != undefined) %7B%0A      if (tabs%5BtabId%5D == undefined) %7B%0A        tabs%5BtabId%5D = %7B'block':true, 'url':changeInfo.url, 'count':0%7D;%0A      %7D else %7B%0A  
     
@@ -1806,24 +1806,26 @@
 geInfo.url;%0A
+  
       tabs%5Bt
@@ -1844,16 +1844,24 @@
 '%5D = 0;%0A
+      %7D%0A
       up
@@ -1876,32 +1876,143 @@
 e();%0A    %7D%0A%7D);%0A%0A
+//Update tabs url%0Achrome.tabs.onRemoved.addListener(function(tabId, removeInfo) %7B%0A    delete tabs%5BtabId%5D;%0A%7D);%0A%0A
 //Update tabs bl
@@ -3027,32 +3027,61 @@
 if (tabs%5Btab.id%5D
+ != undefined && tabs%5Btab.id%5D
 %5B'count'%5D%3E0) %7B%0A 

fix little error