title: Why does the timeout fire before the "click" event loop is complete on Firefox?
body: <p>Steps:</p>
  
  <ol>
  <li>run code in the Firefox</li>
  <li>wait 5 seconds (important!)</li>
  <li>Press OK or Cancel</li>
  <li>expect flag == 0, but it is 10.</li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var flag;
  
  function myFunction(){
      flag = 0 
      console.info("initial", flag);
      setTimeout(function(){
          flag = 10;
      }, 200);
    
      confirm("conf");
     
      alert("should be 0: "+flag);
  }
  
  document.getElementById('button').onclick=myFunction;
     
                            </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="button" id="button"&gt;Click Me!&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>