title: return value of chrome.webRequest.onBeforeRequest based on data in chrome.storage
body: <p>I am trying to to block certain webrequests in my google chrome extension based on data stored in chrome.storage.local. 
  However I can't find a way to return "{cancel:  true };" inside the callback function of onBeforeRequest.addListener. Or to access data from storage.local outside of it's respective callback function due to the asynchronous way of chrome.Storage.local.get().</p>
  
  <p>Here is my relevant code.</p>
  
  <pre><code>chrome.webRequest.onBeforeRequest.addListener( function(info) {
  
      chrome.storage.local.get({requests: []}, function (result) {
  
          // depending on the value of result.requests.[0].item I want to return "{cancel:  true };" in order to block the webrequest
          if(result.requests.[0].item == 0) return {cancel: true}; // however this is obviously in the wrong place
  
      });
  
      // if I put return {cancel: true} here, where it should be, I can't access the data of storage.local.get anymore
      // if(result.requests.[0].item == 0) return {cancel: true};
  
  });
  </code></pre>
  
  <p>Has anyone a solution for this problem? Thanks for your help.</p>