<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212066] branches/safari-603-branch</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212066">212066</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-02-09 22:37:06 -0800 (Thu, 09 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/211913">r211913</a>. rdar://problem/28062149</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsChangeLog">branches/safari-603-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari603branchLayoutTestsimportedw3cChangeLog">branches/safari-603-branch/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#branchessafari603branchLayoutTestsimportedw3cwebplatformtestscustomelementsadoptedcallbackexpectedtxt">branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingexpectedtxt">branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsimportedw3cwebplatformtestshtmlwebappapisscriptingeventloopsmicrotask_after_scriptexpectedtxt">branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsjsdomPromisehtml">branches/safari-603-branch/LayoutTests/js/dom/Promise.html</a></li>
<li><a href="#branchessafari603branchLayoutTestsjsdommodulesmoduleincorrectrelativespecifierexpectedtxt">branches/safari-603-branch/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt</a></li>
<li><a href="#branchessafari603branchSourceWebCoreChangeLog">branches/safari-603-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoredomMicrotaskscpp">branches/safari-603-branch/Source/WebCore/dom/Microtasks.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoredomMicrotasksh">branches/safari-603-branch/Source/WebCore/dom/Microtasks.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/ChangeLog (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/ChangeLog        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/ChangeLog        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2017-02-09  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r211913. rdar://problem/28062149
+
+    2017-02-08  Sam Weinig  &lt;sam@webkit.org&gt;
+
+            REGRESSION (r193286): Promise chain no longer prevent UI refresh
+            &lt;rdar://problem/28062149&gt;
+            https://bugs.webkit.org/show_bug.cgi?id=161291
+
+            Reviewed by Geoffrey Garen.
+
+            * js/dom/Promise.html:
+            Add a new subtest that ensures the ordering of multiple thenables and a setTimeout.
+
+2017-02-09  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r211845. rdar://problem/30187368
</span><span class="cx"> 
</span><span class="cx">     2017-02-07  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/imported/w3c/ChangeLog (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/imported/w3c/ChangeLog        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/imported/w3c/ChangeLog        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-02-09  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r211913. rdar://problem/28062149
+
+    2017-02-08  Sam Weinig  &lt;sam@webkit.org&gt;
+
+            REGRESSION (r193286): Promise chain no longer prevent UI refresh
+            &lt;rdar://problem/28062149&gt;
+            https://bugs.webkit.org/show_bug.cgi?id=161291
+
+            Reviewed by Geoffrey Garen.
+
+            * web-platform-tests/custom-elements/adopted-callback-expected.txt:
+            * web-platform-tests/custom-elements/upgrading-expected.txt:
+            * web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt:
+            Update results for improved promise support.
+
</ins><span class="cx"> 2017-02-09  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rebaseline tests for rdar://problem/30181081.
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsimportedw3cwebplatformtestscustomelementsadoptedcallbackexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -56,4 +56,4 @@
</span><span class="cx"> PASS Inserting the shadow host of a custom element into an HTML document fetched by XHR must enqueue and invoke adoptedCallback 
</span><span class="cx"> PASS Moving the shadow host of a custom element from the owner document into an HTML document fetched by XHR must enqueue and invoke adoptedCallback 
</span><span class="cx"> PASS Inserting a custom element into a detached shadow tree that belongs to an HTML document fetched by XHR must enqueue and invoke adoptedCallback 
</span><del>- 
</del><ins>+
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -24,4 +24,4 @@
</span><span class="cx"> PASS &quot;define&quot; in the document of an iframe must enqueue a custom element upgrade reaction on a connected unresolved custom element 
</span><span class="cx"> PASS Adopting (and leaving disconnceted) an unresolved custom element into the document of an iframe must not enqueue a custom element upgrade reaction 
</span><span class="cx"> PASS Adopting and inserting an unresolved custom element into the document of an iframe must enqueue a custom element upgrade reaction 
</span><del>-
</del><ins>+ 
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsimportedw3cwebplatformtestshtmlwebappapisscriptingeventloopsmicrotask_after_scriptexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx"> 
</span><del>-FAIL Microtask immediately after script assert_array_equals: lengths differ, expected 3 got 4
</del><ins>+PASS Microtask immediately after script 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsjsdomPromisehtml"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/js/dom/Promise.html (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/js/dom/Promise.html        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/js/dom/Promise.html        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -484,6 +484,18 @@
</span><span class="cx">   });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function promiseSetTimeoutOrdering() {
+    var orderNumber = 0;
+    orderNumber++;
+
+    Promise.resolve(null)
+        .then(function(v) { is(orderNumber++, 1, &quot;Called first.&quot;); setTimeout(function() { is(orderNumber++, 6, &quot;Called last.&quot;); runTest(); }, 0); return v; })
+        .then(function(v) { is(orderNumber++, 2, &quot;Called second.&quot;); return v })
+        .then(function(v) { is(orderNumber++, 3, &quot;Called third.&quot;); return v })
+        .then(function(v) { is(orderNumber++, 4, &quot;Called fourth.&quot;); return v })
+        .then(function(v) { is(orderNumber++, 5, &quot;Called fifth.&quot;); return v; })
+}
+
</ins><span class="cx"> var tests = [
</span><span class="cx">   promiseResolve, 
</span><span class="cx">   promiseReject,
</span><span class="lines">@@ -512,6 +524,7 @@
</span><span class="cx">   promiseThenNullResolveFunction,
</span><span class="cx">   promiseCatchNoArg,
</span><span class="cx">   promiseRejectNoHandler,
</span><ins>+  promiseSetTimeoutOrdering,
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><span class="cx"> function runTest() {
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsjsdommodulesmoduleincorrectrelativespecifierexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
</del><ins>+CONSOLE MESSAGE: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
+CONSOLE MESSAGE: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
+CONSOLE MESSAGE: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
</ins><span class="cx"> Test script.onerror will be fired when the incorrect relative specifier is specified.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/ChangeLog        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2017-02-09  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r211913. rdar://problem/28062149
+
+    2017-02-08  Sam Weinig  &lt;sam@webkit.org&gt;
+
+            REGRESSION (r193286): Promise chain no longer prevent UI refresh
+            &lt;rdar://problem/28062149&gt;
+            https://bugs.webkit.org/show_bug.cgi?id=161291
+
+            Reviewed by Geoffrey Garen.
+
+            Add new subtest to js/dom/Promise.html
+
+            * dom/Microtasks.cpp:
+            (WebCore::MicrotaskQueue::append):
+            (WebCore::MicrotaskQueue::remove):
+            (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
+            * dom/Microtasks.h:
+            The microtask queue needs to be completely drained, even of new microtasks added while
+            the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is
+            no longer needed.
+
+2017-02-09  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r211895. rdar://problem/30129966
</span><span class="cx"> 
</span><span class="cx">     2017-02-08  Brady Eidson  &lt;beidson@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoredomMicrotaskscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/dom/Microtasks.cpp (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/dom/Microtasks.cpp        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/Source/WebCore/dom/Microtasks.cpp        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -50,10 +50,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MicrotaskQueue::append(std::unique_ptr&lt;Microtask&gt;&amp;&amp; task)
</span><span class="cx"> {
</span><del>-    if (m_performingMicrotaskCheckpoint)
-        m_tasksAppendedDuringMicrotaskCheckpoint.append(WTFMove(task));
-    else
-        m_microtaskQueue.append(WTFMove(task));
</del><ins>+    m_microtaskQueue.append(WTFMove(task));
</ins><span class="cx"> 
</span><span class="cx">     m_timer.startOneShot(0);
</span><span class="cx"> }
</span><span class="lines">@@ -66,12 +63,6 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    for (size_t i = 0; i &lt; m_tasksAppendedDuringMicrotaskCheckpoint.size(); ++i) {
-        if (m_tasksAppendedDuringMicrotaskCheckpoint[i].get() == &amp;task) {
-            m_tasksAppendedDuringMicrotaskCheckpoint.remove(i);
-            return;
-        }
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MicrotaskQueue::timerFired()
</span><span class="lines">@@ -86,21 +77,22 @@
</span><span class="cx"> 
</span><span class="cx">     SetForScope&lt;bool&gt; change(m_performingMicrotaskCheckpoint, true);
</span><span class="cx"> 
</span><del>-    Vector&lt;std::unique_ptr&lt;Microtask&gt;&gt; queue = WTFMove(m_microtaskQueue);
-    for (auto&amp; task : queue) {
-        auto result = task-&gt;run();
-        switch (result) {
-        case Microtask::Result::Done:
-            break;
-        case Microtask::Result::KeepInQueue:
-            m_microtaskQueue.append(WTFMove(task));
-            break;
</del><ins>+    Vector&lt;std::unique_ptr&lt;Microtask&gt;&gt; toKeep;
+    while (!m_microtaskQueue.isEmpty()) {
+        Vector&lt;std::unique_ptr&lt;Microtask&gt;&gt; queue = WTFMove(m_microtaskQueue);
+        for (auto&amp; task : queue) {
+            auto result = task-&gt;run();
+            switch (result) {
+            case Microtask::Result::Done:
+                break;
+            case Microtask::Result::KeepInQueue:
+                toKeep.append(WTFMove(task));
+                break;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (auto&amp; task : m_tasksAppendedDuringMicrotaskCheckpoint)
-        m_microtaskQueue.append(WTFMove(task));
-    m_tasksAppendedDuringMicrotaskCheckpoint.clear();
</del><ins>+    m_microtaskQueue = WTFMove(toKeep);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoredomMicrotasksh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/dom/Microtasks.h (212065 => 212066)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/dom/Microtasks.h        2017-02-10 06:37:02 UTC (rev 212065)
+++ branches/safari-603-branch/Source/WebCore/dom/Microtasks.h        2017-02-10 06:37:06 UTC (rev 212066)
</span><span class="lines">@@ -65,7 +65,6 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_performingMicrotaskCheckpoint = false;
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;Microtask&gt;&gt; m_microtaskQueue;
</span><del>-    Vector&lt;std::unique_ptr&lt;Microtask&gt;&gt; m_tasksAppendedDuringMicrotaskCheckpoint;
</del><span class="cx"> 
</span><span class="cx">     // FIXME: Instead of a Timer, we should have a centralized Event Loop that calls performMicrotaskCheckpoint()
</span><span class="cx">     // on every iteration, implementing https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9
</span></span></pre>
</div>
</div>

</body>
</html>