title: Service Worker PostMessage Error
body: <p>I have the following:</p>
  
  <pre><code>//main.js
  if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('worker.js').then(function(worker){
  //      firebase.messaging().useServiceWorker(worker);
      navigator.serviceWorker.controller.postMessage([MESSAGE HERE]);
      });
  }
  </code></pre>
  
  <p>And in worker.js:</p>
  
  <pre><code>self.onmessage=function(e){
      console.log(e.data);
  }
  </code></pre>
  
  <p>But in main.js, I get this error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'postMessage' of null</p>
  </blockquote>
  
  <p>Why is this happening?</p>