title: chrome.webNavigation undefined
body: <p>I am writing my first Google extension code, and I am getting a weird error I have never seen in my life.</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'onCompleted' of undefined background.js:4
  (anonymous function)
  </code></pre>
  
  <p>I am decently new to Javascript btw (have extensive knowledge in Java though).</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>chrome.webNavigation.onCompleted.addListener(function(){//error right here
  if(hasHostSuffix(document.URL,'mysite.com'))
  {
      console.log("Web navigation commited!");
      var links = document.getElementsByName("a");
      for(var i = 0; i &lt; links.length; i++)
      {
          console.log(links[i].getAttribute("href"));
          if(links[i].style.backgroundColor='#272727')
          {
              links[i].className="gone";
          }
      }
  }
  });
  </code></pre>
  
  <p>I haven't been able to find any solid information on my I am getting this error.</p>
  
  <p>Any help would be highly appreciated :)</p>
  
  <p>EDIT:</p>
  
  <p>Was brought to my attention that I forgot some vital info xD My manfiest:</p>
  
  <pre><code>{
  "manifest_version": 2,
  ...,
  "permissions": [
      "webNavigation"
  ],
  ...,
  "content_scripts":[
      {
          "matches":["http://www.mysite.com/*"],
          "css":["ur_customstyle.css"],
          "js":["background.js"]
      }
  ]
  }
  </code></pre>