title: Calling Worker inside a long loop
body: <p>Sorry if duplicate, but couldn't find my exact case. I'm playing around Web Worker and is pretty interesting. I was testing different cases and hit this.</p>
  
  <p>Main :</p>
  
  <pre><code>var myWorker = new Worker("WK.js");
  
  for (var i = 0; i &lt;= 1000000000; i++) {
      myWorker.postMessage(i);
  }
  
  myWorker.onmessage = function (e) {
      alert(e.data);
  }
  </code></pre>
  
  <p>Worker :</p>
  
  <pre><code>var sum = 0;
          self.onmessage = function (e) {
          if (e.data == 1000000000) { postMessage("done" + sum); }
          sum += e.data;
      }
  </code></pre>
  
  <p>On the worker script, I'm just summing up the passed values and post back the sum once done. The problem I face is, the above code crashes my browser(all) for this number(~1000000000) however if I move that loop to worker script, it works fine. So is there a limit for the number of postMessage calls per duration? Please note I do know this is bad code, just for testing.</p>