title: Unresponsive Google Chrome while running HTML5 Web workers
body: <p>I am using the following code to run webworker to fune prime numbers in a web page in the latest Google Chrome</p>
  
  <p><a href="https://dl.dropbox.com/u/655237/project/prime.html" rel="nofollow">https://dl.dropbox.com/u/655237/project/prime.html</a></p>
  
  <p>However after clicking the start Worker button,  the stop button becomes unresponsive for some time. After 30 second or so it becomes active when it is mouse hovered. This does not happen in Firefox.</p>
  
  <p>Is there any flaw in the code ?</p>
  
  <p><strong>prime.html</strong> </p>
  
  <pre><code>        &lt;section&gt;
              Last Prime Found:-  &lt;p id="number"&gt;NA&lt;/p&gt;
              &lt;button id="prime"&gt;Find &amp;nbsp; Prime&lt;/button&gt;
              &lt;button id="primew"&gt;Start &amp;nbsp;Worker&lt;/button&gt;
              &lt;button id="primes"&gt;Stop &amp;nbsp;Worker&lt;/button&gt;
          &lt;/section&gt;
          &lt;script&gt;
              var worker;
              document.querySelector('#prime').addEventListener('click', function () {
                  findPrime();
              }, false);
              document.querySelector('#primew').addEventListener('click', function () {
                  findPrimeW();
              }, false);
              document.querySelector('#primes').addEventListener('click', function () {
                  stopWorker();
              }, false);
  
              function findPrime(){
                  var n = 1;
                  search: while (true) {
                      n += 1;
                      for (var i = 2; i &lt;= Math.sqrt(n); i += 1)
                          if (n % i == 0)
                              continue search;
                      // found a prime!
                      document.querySelector("#number").textContent=n;
                  }
              }
              function findPrimeW(){
                  worker = new Worker('js/worker1.js');
                  worker.onmessage = function (event) {
                      document.querySelector("#number").textContent = event.data;
                  };
              }
  
              function stopWorker()
              { 
                  worker.terminate();
              }
          &lt;/script&gt;
  </code></pre>
  
  <p><strong>worker1.js</strong></p>
  
  <pre><code>    var n = 1;
  search: while (true) {
    n += 1;
    for (var i = 2; i &lt;= Math.sqrt(n); i += 1)
      if (n % i == 0)
       continue search;
    // found a prime!
    postMessage(n);
  }
  </code></pre>
  
  <p>Another example is this
  <a href="https://dl.dropbox.com/u/655237/events/gdg-html5/index.html#/webworkers" rel="nofollow">https://dl.dropbox.com/u/655237/events/gdg-html5/index.html#/webworkers</a></p>
  
  <p>You can not change the slide for a some time after clicking "Start Worker" button. Ideally it should not happen as the heavy weight computation is delegated to a separate web worker.</p>