title: Synchronous call in Google Chrome extension
body: <p>I'm working on Google Chrome extension, which has to block/redirect some outgoing requests. For this purpose, I use <code>chrome.webRequest.onBeforeRequest</code> listener.
  To decide, whether to block request or not, I need some information about the tab request is sent from. I can get it using <code>chrome.tabs.get(integer tabId, function callback)</code>, but callback is asynchronous, which means it may be called after the value is returned from <code>onBeforeRequest</code> listener.</p>
  
  <pre><code>chrome.webRequest.onBeforeRequest.addListener(function(details){
   chrome.tabs.get(details.tabId, function(tab){
    // get info from tab
   }); 
   // based on info from tab return redirect or not
  }), {
   urls: ["&lt;all_urls&gt;"],
   types: ["main_frame"]
  }, ["blocking"]);
  </code></pre>
  
  <p>Is there a way to synchronize the call? Or maybe some other option.</p>