title: TypeError: browser.webRequest is undefined
body: <p>I am trying to log errors using webextension. I have the follwoing simple example to start with:</p>
  
  <p><code>manifest.json</code>:</p>
  
  <pre><code>{
  
    "manifest_version": 2,
    "name": "testOnErrorWebex",
    "version": "1.0",
  
    "description": "Adds a red border to all webpages matching mozilla.org.",
  
    "icons": {
      "48": "icons/border-48.png"
    },
  
    "content_scripts": [
      {
        "matches": ["&lt;all_urls&gt;"],
        "js": ["testOnErrorWebex.js"]
      }
    ],
  
    "permissions": [
    "webRequest"
  ]
  
  }
  </code></pre>
  
  <p>And, the content script: <code>testOnErrorWebex.js</code></p>
  
  <pre><code>console.log("-- inside js file --");
  
  var target = "&lt;all_urls&gt;"; 
  
  /*
  e.g., with no network:
  "https://developer.mozilla.org/en-US/"
  NS_ERROR_NET_ON_RESOLVED in Firefox
  net::ERR_INTERNET_DISCONNECTED in Chrome
  */
  
  function logError(responseDetails) {
    console.log("-- inside logError  --");
    console.log("inside logError");
    console.log(responseDetails.url);
    console.log(responseDetails.error);
  }
  
  browser.webRequest.onErrorOccurred.addListener(
    logError,
    {urls: [target]}
  );
  </code></pre>
  
  <p>When I try the extension and load it, then type any bad URL that fires an error:
  e.g., <code>https://doesnotexist/</code></p>
  
  <p>The following line from the content script is printed:</p>
  
  <pre><code>-- inside js file --
  </code></pre>
  
  <p>But I get this eerro:</p>
  
  <pre><code>TypeError: browser.webRequest is undefined
  </code></pre>