I hope implement following code:
//background.js
chrome.webRequest.onBeforeRequest.addListener(function (details) {
  var allTabUrls
  // use chrome.tabs
  getAllTabUrls(function(urls)) {
    allTabUrls = urls
  }
  handleUrls(allTabUrls)
}, {urls: ["<all_urls>"]})
I find all chrome callback is run in asynchronize, so my code will first run handleUrls(allTabUrls) before allTabUrls = urls, how to wait async function finish and then run handleUrls(allTabUrls)
 
    