title: Passing message from background.js to popup.js
body: <p>I'm trying to implement my own chrome extension on which, on a certain event, create a browser notification and fills the popup with data calculated in background.js</p>
  <p>Here is my <code>manifest.json</code> file:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;name&quot;: &quot;Dummy name&quot;,
      &quot;description&quot;: &quot;Description&quot;,
      &quot;manifest_version&quot;: 2,
      &quot;version&quot;: &quot;1.1.3&quot;,
      &quot;icons&quot;: {
          &quot;16&quot;: &quot;icon_16.png&quot;,
          &quot;48&quot;: &quot;icon_48.png&quot;,
          &quot;128&quot;: &quot;icon_128.png&quot;,
          &quot;256&quot;: &quot;icon_256.png&quot;
      },
      &quot;browser_action&quot;: {
          &quot;default_icon&quot;: &quot;icon_48.png&quot;,
          &quot;default_title&quot;: &quot;Test&quot;,
          &quot;default_popup&quot;: &quot;popup.html&quot;
      },
      &quot;permissions&quot;: [&quot;background&quot;,&quot;webRequest&quot;,&quot;webRequestBlocking&quot;,&quot;webNavigation&quot;,&quot;tabs&quot;,&quot;notifications&quot;],
      &quot;background&quot;: {
          &quot;scripts&quot;:[&quot;jquery-1.8.1.min.js&quot;,&quot;classy.js&quot;,&quot;background.js&quot;]
      }
  }
  </code></pre>
  <p>My call to <code>sendMessage</code> in <code>background.js</code></p>
  <pre class="lang-js prettyprint-override"><code>show : function(result) {
      var that = this;
      chrome.extension.sendMessage({greeting: &quot;hello&quot;}, function(response) {
          console.log(response);
      });
  
      if(window.webkitNotifications) {
          var notification = webkitNotifications.createHTMLNotification('notification.html');
          notification.show();
          setTimeout(function(){
              notification.cancel();
              }, '7000');
          }
      }
  </code></pre>
  <p>My message listener in <code>popup.js</code> (from chrome extension samples)</p>
  <pre class="lang-js prettyprint-override"><code>chrome.extension.onMessage.addListener(
    function(request, sender, sendResponse) {
      console.log(sender.tab ?
                  &quot;from a content script:&quot; + sender.tab.url :
                  &quot;from the extension&quot;);
      if (request.greeting == &quot;hello&quot;)
        sendResponse({farewell: &quot;goodbye&quot;});
    });
  </code></pre>
  <p>The only error I get is a</p>
  <blockquote>
  <p>Port error: Could not establish connection. Receiving end does not
  exist.</p>
  </blockquote>
  <p>Thank you for your help!</p>