title: Chrome Message passing. Uncaught Error: Error connecting to extension
body: <p>So I'm very new to Chrome's message passing, and I'm trying to use it to have my background page be alerted when the DOM of a page is modified (using some injected js). </p>
  
  <p>I'm only trying to have one way communication, but if I open up console on the tab while the extension is running, it tells me "Uncaught Error: Error connecting to extension [my extension id]."</p>
  
  <p>For simplicity, I'll say my background page's background.js has these lines of code: </p>
  
  <pre><code>chrome.runtime.onMessage.addListener(
    function(){
      if (modified == "true") {
        alert("modified message recieved");
        fourth();
      }
    }
  );
  </code></pre>
  
  <p>And my content script is:</p>
  
  <pre><code>function subtreeModified(){
    chrome.runtime.sendMessage({modified: "true"});
    alert("modified message sent");
  }
  
  document.addEventListener("DOMSubtreeModified", subtreeModified, false);
  </code></pre>
  
  <p>I've been testing this, and whenever the page DOM is modified, I get a bunch of alerts that say "modified message sent," but none that say "modified message recieved." Thoughts/tips?</p>