title: How to send a message between Chrome extension popup and content script?
body: <p>Following the Google tutorial, I am sending a message from a popup script to a content script. The message passes correctly but when I call the response callback I get the following error:</p>
  
  <pre><code>Attempting to use a disconnected port object
  </code></pre>
  
  <p>This is popup.js:</p>
  
  <pre><code>chrome.tabs.query(
    { active: true, currentWindow: true }, 
    function(tabs) {
      chrome.tabs.sendMessage(
        tabs[0].id, 
        { greeting: "hello" }, 
        function(response) {
          console.log(response);
        });
  });
  </code></pre>
  
  <p>This is content.js:</p>
  
  <pre><code>chrome.runtime.onMessage.addListener(
    function(request, sender, sendResponse) {
      sendResponse('goodbye'); // &lt;- Error here
    });
  </code></pre>
  
  <p>How can I send this message and get the response back?</p>