title: Chrome Extention Port error: Could not establish connection. Receiving end does not exist
body: <p>I am getting this error when trying to send a message from popup to my contentscript.  What I am trying to do is get the document of the current tab from my content.js and send it to the popup.  How can I fix this erro?</p>
  
  <pre><code>{
    "manifest_version": 2,
    "name": "Chrome Snapshot",
    "description": "Save images and screenshots of sites to Dropbox.",
    "version": "1.0",
    "permissions": [
      "&lt;all_urls&gt;",
      "tabs"
    ],
    "browser_action": {
      "default_icon": "icon.png",
      "default_popup": "html/popup.html"
    },
    "background": {
      "scripts": [
        "vendor/dropbox.min.js",
        "vendor/jquery-2.0.2.min.js"
      ],
      "persistant": false
    },
    "content_scripts" : [{
      "all_frames": true,
      "matches" : ["*://*/*"],
      "js" : ["js/content.js"],
      "run_at": "document_end"
    }]
  }
  </code></pre>
  
  <p>js/popup.js</p>
  
  <pre><code>chrome.runtime.sendMessage({message: 'hi'}, function(response) {
    console.log(response);
  });
  </code></pre>
  
  <p>js/content.js</p>
  
  <pre><code>chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
    console.log('message', message);
    sendResponse({farewell: 'goodbye'}); 
  });
  </code></pre>
  
  <p><strong>Edit #1</strong> Still getting the same error <code>Port error: Could not establish connection. Receiving end does not exist. miscellaneous_bindings:235
  chromeHidden.Port.dispatchOnDisconnect</code></p>
  
  <p>fixed mispelling 'persistent' in manifest<br>
  updated js/popup.js</p>
  
  <pre><code>chrome.tabs.query({'active': true,'currentWindow':true}, function(tab){
      console.log('from tab', tab[0]);
      chrome.tabs.sendMessage(tab[0].id, {message: 'hi'}, function(response){
        console.log(JSON.stringify(response));
      });
    });
  </code></pre>