Title: [211913] trunk
Revision
211913
Author
[email protected]
Date
2017-02-08 17:42:55 -0800 (Wed, 08 Feb 2017)

Log Message

REGRESSION (r193286): Promise chain no longer prevent UI refresh
<rdar://problem/28062149>
https://bugs.webkit.org/show_bug.cgi?id=161291

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

* 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.

Source/WebCore:

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.

LayoutTests:

* js/dom/Promise.html:
Add a new subtest that ensures the ordering of multiple thenables and a setTimeout.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211912 => 211913)


--- trunk/LayoutTests/ChangeLog	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/ChangeLog	2017-02-09 01:42:55 UTC (rev 211913)
@@ -1,3 +1,14 @@
+2017-02-08  Sam Weinig  <[email protected]>
+
+        REGRESSION (r193286): Promise chain no longer prevent UI refresh
+        <rdar://problem/28062149>
+        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-08  Eric Carlson  <[email protected]>
 
         [MediaStream] Remove legacy Navigator.webkitGetUserMedia

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (211912 => 211913)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-09 01:42:55 UTC (rev 211913)
@@ -1,3 +1,16 @@
+2017-02-08  Sam Weinig  <[email protected]>
+
+        REGRESSION (r193286): Promise chain no longer prevent UI refresh
+        <rdar://problem/28062149>
+        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.
+
 2017-02-08  Youenn Fablet  <[email protected]>
 
         RTCPeerConnection constructor can take null as input

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt (211912 => 211913)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback-expected.txt	2017-02-09 01:42:55 UTC (rev 211913)
@@ -56,4 +56,4 @@
 PASS Inserting the shadow host of a custom element into an HTML document fetched by XHR must enqueue and invoke adoptedCallback 
 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 
 PASS Inserting a custom element into a detached shadow tree that belongs to an HTML document fetched by XHR must enqueue and invoke adoptedCallback 
- 
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt (211912 => 211913)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt	2017-02-09 01:42:55 UTC (rev 211913)
@@ -24,4 +24,4 @@
 PASS "define" in the document of an iframe must enqueue a custom element upgrade reaction on a connected unresolved custom element 
 PASS Adopting (and leaving disconnceted) an unresolved custom element into the document of an iframe must not enqueue a custom element upgrade reaction 
 PASS Adopting and inserting an unresolved custom element into the document of an iframe must enqueue a custom element upgrade reaction 
-
+ 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt (211912 => 211913)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/microtask_after_script-expected.txt	2017-02-09 01:42:55 UTC (rev 211913)
@@ -1,3 +1,3 @@
 
-FAIL Microtask immediately after script assert_array_equals: lengths differ, expected 3 got 4
+PASS Microtask immediately after script 
 

Modified: trunk/LayoutTests/js/dom/Promise.html (211912 => 211913)


--- trunk/LayoutTests/js/dom/Promise.html	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/js/dom/Promise.html	2017-02-09 01:42:55 UTC (rev 211913)
@@ -484,6 +484,18 @@
   });
 }
 
+function promiseSetTimeoutOrdering() {
+    var orderNumber = 0;
+    orderNumber++;
+
+    Promise.resolve(null)
+        .then(function(v) { is(orderNumber++, 1, "Called first."); setTimeout(function() { is(orderNumber++, 6, "Called last."); runTest(); }, 0); return v; })
+        .then(function(v) { is(orderNumber++, 2, "Called second."); return v })
+        .then(function(v) { is(orderNumber++, 3, "Called third."); return v })
+        .then(function(v) { is(orderNumber++, 4, "Called fourth."); return v })
+        .then(function(v) { is(orderNumber++, 5, "Called fifth."); return v; })
+}
+
 var tests = [
   promiseResolve, 
   promiseReject,
@@ -512,6 +524,7 @@
   promiseThenNullResolveFunction,
   promiseCatchNoArg,
   promiseRejectNoHandler,
+  promiseSetTimeoutOrdering,
 ];
 
 function runTest() {

Modified: trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt (211912 => 211913)


--- trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt	2017-02-09 01:42:55 UTC (rev 211913)
@@ -1,6 +1,6 @@
-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with "/", "./", or "../".
-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with "/", "./", or "../".
-CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with "/", "./", or "../".
+CONSOLE MESSAGE: TypeError: Module specifier does not start with "/", "./", or "../".
+CONSOLE MESSAGE: TypeError: Module specifier does not start with "/", "./", or "../".
+CONSOLE MESSAGE: TypeError: Module specifier does not start with "/", "./", or "../".
 Test script.onerror will be fired when the incorrect relative specifier is specified.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/Source/WebCore/ChangeLog (211912 => 211913)


--- trunk/Source/WebCore/ChangeLog	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/Source/WebCore/ChangeLog	2017-02-09 01:42:55 UTC (rev 211913)
@@ -1,3 +1,22 @@
+2017-02-08  Sam Weinig  <[email protected]>
+
+        REGRESSION (r193286): Promise chain no longer prevent UI refresh
+        <rdar://problem/28062149>
+        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-08  Eric Carlson  <[email protected]>
 
         [MediaStream] Remove legacy Navigator.webkitGetUserMedia

Modified: trunk/Source/WebCore/dom/Microtasks.cpp (211912 => 211913)


--- trunk/Source/WebCore/dom/Microtasks.cpp	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/Source/WebCore/dom/Microtasks.cpp	2017-02-09 01:42:55 UTC (rev 211913)
@@ -50,10 +50,7 @@
 
 void MicrotaskQueue::append(std::unique_ptr<Microtask>&& task)
 {
-    if (m_performingMicrotaskCheckpoint)
-        m_tasksAppendedDuringMicrotaskCheckpoint.append(WTFMove(task));
-    else
-        m_microtaskQueue.append(WTFMove(task));
+    m_microtaskQueue.append(WTFMove(task));
 
     m_timer.startOneShot(0);
 }
@@ -66,12 +63,6 @@
             return;
         }
     }
-    for (size_t i = 0; i < m_tasksAppendedDuringMicrotaskCheckpoint.size(); ++i) {
-        if (m_tasksAppendedDuringMicrotaskCheckpoint[i].get() == &task) {
-            m_tasksAppendedDuringMicrotaskCheckpoint.remove(i);
-            return;
-        }
-    }
 }
 
 void MicrotaskQueue::timerFired()
@@ -86,21 +77,22 @@
 
     SetForScope<bool> change(m_performingMicrotaskCheckpoint, true);
 
-    Vector<std::unique_ptr<Microtask>> queue = WTFMove(m_microtaskQueue);
-    for (auto& task : queue) {
-        auto result = task->run();
-        switch (result) {
-        case Microtask::Result::Done:
-            break;
-        case Microtask::Result::KeepInQueue:
-            m_microtaskQueue.append(WTFMove(task));
-            break;
+    Vector<std::unique_ptr<Microtask>> toKeep;
+    while (!m_microtaskQueue.isEmpty()) {
+        Vector<std::unique_ptr<Microtask>> queue = WTFMove(m_microtaskQueue);
+        for (auto& task : queue) {
+            auto result = task->run();
+            switch (result) {
+            case Microtask::Result::Done:
+                break;
+            case Microtask::Result::KeepInQueue:
+                toKeep.append(WTFMove(task));
+                break;
+            }
         }
     }
 
-    for (auto& task : m_tasksAppendedDuringMicrotaskCheckpoint)
-        m_microtaskQueue.append(WTFMove(task));
-    m_tasksAppendedDuringMicrotaskCheckpoint.clear();
+    m_microtaskQueue = WTFMove(toKeep);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Microtasks.h (211912 => 211913)


--- trunk/Source/WebCore/dom/Microtasks.h	2017-02-09 01:30:56 UTC (rev 211912)
+++ trunk/Source/WebCore/dom/Microtasks.h	2017-02-09 01:42:55 UTC (rev 211913)
@@ -65,7 +65,6 @@
 
     bool m_performingMicrotaskCheckpoint = false;
     Vector<std::unique_ptr<Microtask>> m_microtaskQueue;
-    Vector<std::unique_ptr<Microtask>> m_tasksAppendedDuringMicrotaskCheckpoint;
 
     // FIXME: Instead of a Timer, we should have a centralized Event Loop that calls performMicrotaskCheckpoint()
     // on every iteration, implementing https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to