<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>140043</bug_id>
          
          <creation_ts>2015-01-02 10:20:28 -0800</creation_ts>
          <short_desc>js/dom/Promise.html is flaky</short_desc>
          <delta_ts>2017-01-18 16:34:36 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=160857</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>147933</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>ryanhaddad</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1058446</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-01-02 10:20:28 -0800</bug_when>
    <thetext>js/dom/Promise.html is flaky, frequently failing in debug builds. Not sure if it&apos;s a test deficiency, or a legitimate bug.

About to run test - promiseAsync
PASS foo is foo
PASS foo is foo
PASS foo is foo
FAIL foo should be bar</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058449</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-01-02 10:32:51 -0800</bug_when>
    <thetext>Marked as flaky in &lt;http://trac.webkit.org/r177865&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058450</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-01-02 10:36:29 -0800</bug_when>
    <thetext>Are promise and setTimeout timers on different event queues?

function promiseAsync() {
  var global = &quot;foo&quot;;
  var f = new Promise(function(r1, r2) {
    is(global, &quot;foo&quot;, &quot;Global should be foo&quot;);
    r1(42);
    is(global, &quot;foo&quot;, &quot;Global should still be foo&quot;);
    setTimeout(function() {
      is(global, &quot;bar&quot;, &quot;Global should still be bar!&quot;);
      runTest();
    }, 0);
  }).then(function() {
    global = &quot;bar&quot;;
  });
  is(global, &quot;foo&quot;, &quot;Global should still be foo (2)&quot;);
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058485</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2015-01-02 17:34:01 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Are promise and setTimeout timers on different event queues?

They are...kind of.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058487</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2015-01-02 17:39:47 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Are promise and setTimeout timers on different event queues?
&gt; 
&gt; They are...kind of.

I don&apos;t think anything in our implementation ensures this ordering, but it really should. This is a great example of why it would be great if we have a unified event loop mechanism.

In this case, the bug is that the .then() should run at the next microtask checkpoint, which is defined as being before the next chance for a timer to fire. Our implementation of Promises does not use the microtask checkpoint, but rather uses ScriptExecutionContext::postTask() mechanism, which is not quite the same thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1267943</commentid>
    <comment_count>5</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2017-01-18 16:34:36 -0800</bug_when>
    <thetext>The test is also flaky on release, so I removed the debug flag in http://trac.webkit.org/projects/webkit/changeset/210898

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&amp;tests=js%2Fdom%2FPromise.html</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>