title: Error - Cannot call method 'sendRequest' of undefined
body: <p>i am trying to build a RSS Fetcher Extension using this tutorial -   </p>
  
  <p><a href="http://www.lifehacker.com.au/2011/11/how-to-build-a-chrome-extension" rel="nofollow">http://www.lifehacker.com.au/2011/11/how-to-build-a-chrome-extension</a></p>
  
  <p>But I guess this is a little bit old and Google already made some changes. The Extension for download there doesn't work at all. I've solved many errors to make it work but im stucked in this:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot call method 'sendRequest' of undefined</p>
  </blockquote>
  
  <p>This is my <strong>popup.html</strong> file where the error is.</p>
  
  <pre><code>function fetch_feed() {
  chrome.extension.sendRequest({'action' : 'fetch_feed', 'url' : 'http://spfc.terra.com.br/rss/news.xml'}, 
      function(response) {
          display_stories(response);
          }
      );
  }
  
  function display_stories(feed_data) {
      var xml_doc = $.parseXML(feed_data);
      $xml = $(xml_doc);
      var items = $xml.find("item");
      $('#popup').html('&lt;img src="logo.png" id="logo" onclick="open_item(\'http://spfc.terra.com.br/\'); window.close();" /&gt;&lt;br clear="all" /&gt;');
      items.each(function(index, element) {
          var post = parse_post(element);
          var item = '';
          var class2 = '';
          if (index &gt;= localStorage['unread_count']) {
              // // console.log('visited');
              item += '&lt;div class="post read"&gt;';
          }
          else {
              item += '&lt;div class="post"&gt;'
          }
          item += '&lt;span class="tag"&gt;' + post.tag + '&lt;/span&gt;\
                      &lt;a href="' + post.url + '"&gt;\
                          &lt;div id="' + post.id + '" class="item" onclick="open_item(\'' + post.url + '\');"&gt;\
                              &lt;img src="' + post.img + '" width="107" height="60" /&gt;\
                              &lt;h4&gt;' + post.title + '&lt;/h4&gt;\
                              &lt;span class="description"&gt;' + post.description + '...&lt;/span&gt;\
                          &lt;/div&gt;\
                      &lt;/a&gt;';
          item += '&lt;/div&gt;';
          $('#popup').append(item);
      });
  }
  </code></pre>
  
  <p>By the way i have also an error in <strong>background.html</strong>, in this part:</p>
  
  <pre><code>function fetch_feed(url, callback) {
      var xhr = new XMLHttpRequest();
      xhr.onreadystatechange = function(data) {
        if (xhr.readyState == 4) {
          if (xhr.status == 200) {
            var data = xhr.responseText;
            callback(data);
          } else {
            callback(null);
          }
        }
      }
      // Note that any URL fetched here must be matched by a permission in
      // the manifest.json file!
      xhr.open('GET', url, true);
      xhr.send();
  }   
  
  
  function onRequest(request, sender, callback) {
      if (request.action == 'fetch_feed') {
        fetch_feed(request.url, callback);
      }
  }
  
  
  chrome.extension.onRequest.addListener(onRequest);      
  </code></pre>
  
  <p>Is the same error but with another property:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'onRequest' of undefined </p>
  </blockquote>
  
  <p>P.S. i've tried to find the solution here before ask and couldn't. Wait for some help to solve it. </p>