Title: [258702] trunk
Revision
258702
Author
[email protected]
Date
2020-03-19 09:42:24 -0700 (Thu, 19 Mar 2020)

Log Message

[Web Animations] Mark promises as handled when rejected
https://bugs.webkit.org/show_bug.cgi?id=209240
<rdar://problem/60592305>

Patch by Antoine Quint <[email protected]> on 2020-03-19
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Add the new WPT tests added for this spec change (https://github.com/web-platform-tests/wpt/pull/22314) and revert some workarounds
made in our copy of WPT tests to previously silence flaky console output related to promise rejections (added in r258275 and r258276).

* web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/finished.html:
* web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/ready.html:
* web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html:
* web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html:

Source/WebCore:

Implementing the spec change discussed in https://github.com/w3c/csswg-drafts/issues/4556.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::cancel):
(WebCore::WebAnimation::resetPendingTasks):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-03-19 16:42:24 UTC (rev 258702)
@@ -1,3 +1,21 @@
+2020-03-19  Antoine Quint  <[email protected]>
+
+        [Web Animations] Mark promises as handled when rejected
+        https://bugs.webkit.org/show_bug.cgi?id=209240
+        <rdar://problem/60592305>
+
+        Reviewed by Youenn Fablet.
+
+        Add the new WPT tests added for this spec change (https://github.com/web-platform-tests/wpt/pull/22314) and revert some workarounds
+        made in our copy of WPT tests to previously silence flaky console output related to promise rejections (added in r258275 and r258276).
+
+        * web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt:
+        * web-platform-tests/web-animations/interfaces/Animation/finished.html:
+        * web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt:
+        * web-platform-tests/web-animations/interfaces/Animation/ready.html:
+        * web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html:
+        * web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html:
+
 2020-03-18  Frank Yang  <[email protected]>
 
         [CSS Writing Modes] Import css/css-writing-modes from WPT

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt	2020-03-19 16:42:24 UTC (rev 258702)
@@ -20,4 +20,5 @@
 PASS Test finished promise is not resolved once the animation falls out finished state even though the current finished promise is generated soon after animation state became finished 
 PASS Finished promise should be resolved after the ready promise is resolved 
 PASS Finished promise should be rejected after the ready promise is rejected 
+PASS Finished promise does not report an unhandledrejection when rejected 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished.html (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished.html	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished.html	2020-03-19 16:42:24 UTC (rev 258702)
@@ -395,5 +395,22 @@
   return Promise.race([timeout, testSuccess]);
 }, 'Finished promise should be rejected after the ready promise is rejected');
 
+promise_test(async t => {
+  const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
+
+  // Ensure the finished promise is created
+  const finished = animation.finished;
+
+  window.addEventListener(
+    'unhandledrejection',
+    t.unreached_func('Should not get an unhandled rejection')
+  );
+
+  animation.cancel();
+
+  // Wait a moment to allow a chance for the event to be dispatched.
+  await waitForAnimationFrames(2);
+}, 'Finished promise does not report an unhandledrejection when rejected');
+
 </script>
 </body>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt	2020-03-19 16:42:24 UTC (rev 258702)
@@ -2,4 +2,5 @@
 PASS A new ready promise is created when play()/pause() is called 
 PASS Redundant calls to play() do not generate new ready promise objects 
 PASS The ready promise is fulfilled with its Animation 
+PASS The ready promise does not report an unhandledrejection when rejected 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html	2020-03-19 16:42:24 UTC (rev 258702)
@@ -57,5 +57,22 @@
   });
 }, 'The ready promise is fulfilled with its Animation');
 
+promise_test(async t => {
+  const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
+
+  // Ensure the ready promise is created
+  const ready = animation.ready;
+
+  window.addEventListener(
+    'unhandledrejection',
+    t.unreached_func('Should not get an unhandled rejection')
+  );
+
+  animation.cancel();
+
+  // Wait a moment to allow a chance for the event to be dispatched.
+  await waitForAnimationFrames(2);
+}, 'The ready promise does not report an unhandledrejection when rejected');
+
 </script>
 </body>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html	2020-03-19 16:42:24 UTC (rev 258702)
@@ -304,7 +304,7 @@
   const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
   await animation.ready;
 
-  const originalFinishPromise = animation.finished.catch(() => {});
+  const originalFinishPromise = animation.finished;
 
   animation.cancel();
   assert_equals(animation.startTime, null);

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html (258701 => 258702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html	2020-03-19 16:42:24 UTC (rev 258702)
@@ -94,7 +94,7 @@
 
   const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
 
-  const originalReadyPromise = animation.ready.catch(() => {});
+  const originalReadyPromise = animation.ready;
   animation.cancel();
   assert_equals(animation.startTime, null);
   assert_equals(animation.currentTime, null);

Modified: trunk/Source/WebCore/ChangeLog (258701 => 258702)


--- trunk/Source/WebCore/ChangeLog	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/Source/WebCore/ChangeLog	2020-03-19 16:42:24 UTC (rev 258702)
@@ -1,3 +1,17 @@
+2020-03-19  Antoine Quint  <[email protected]>
+
+        [Web Animations] Mark promises as handled when rejected
+        https://bugs.webkit.org/show_bug.cgi?id=209240
+        <rdar://problem/60592305>
+
+        Reviewed by Youenn Fablet.
+
+        Implementing the spec change discussed in https://github.com/w3c/csswg-drafts/issues/4556.
+
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::cancel):
+        (WebCore::WebAnimation::resetPendingTasks):
+
 2020-03-19  Charlie Turner  <[email protected]>
 
         Fix many warnings with Clang 7.0 on GTK x86-64 in Debug.

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (258701 => 258702)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2020-03-19 16:03:04 UTC (rev 258701)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2020-03-19 16:42:24 UTC (rev 258702)
@@ -632,19 +632,20 @@
         resetPendingTasks(silently);
 
         // 2. Reject the current finished promise with a DOMException named "AbortError".
+        // 3. Set the [[PromiseIsHandled]] internal slot of the current finished promise to true.
         if (silently == Silently::No && !m_finishedPromise->isFulfilled())
-            m_finishedPromise->reject(Exception { AbortError });
+            m_finishedPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
 
-        // 3. Let current finished promise be a new (pending) Promise object.
+        // 4. Let current finished promise be a new (pending) Promise object.
         m_finishedPromise = makeUniqueRef<FinishedPromise>(*this, &WebAnimation::finishedPromiseResolve);
 
-        // 4. Create an AnimationPlaybackEvent, cancelEvent.
-        // 5. Set cancelEvent's type attribute to cancel.
-        // 6. Set cancelEvent's currentTime to null.
-        // 7. Let timeline time be the current time of the timeline with which animation is associated. If animation is not associated with an
+        // 5. Create an AnimationPlaybackEvent, cancelEvent.
+        // 6. Set cancelEvent's type attribute to cancel.
+        // 7. Set cancelEvent's currentTime to null.
+        // 8. Let timeline time be the current time of the timeline with which animation is associated. If animation is not associated with an
         //    active timeline, let timeline time be n unresolved time value.
-        // 8. Set cancelEvent's timelineTime to timeline time. If timeline time is unresolved, set it to null.
-        // 9. If animation has a document for timing, then append cancelEvent to its document for timing's pending animation event queue along
+        // 9. Set cancelEvent's timelineTime to timeline time. If timeline time is unresolved, set it to null.
+        // 10. If animation has a document for timing, then append cancelEvent to its document for timing's pending animation event queue along
         //    with its target, animation. If animation is associated with an active timeline that defines a procedure to convert timeline times
         //    to origin-relative time, let the scheduled event time be the result of applying that procedure to timeline time. Otherwise, the
         //    scheduled event time is an unresolved time value.
@@ -716,10 +717,11 @@
     applyPendingPlaybackRate();
 
     // 5. Reject animation's current ready promise with a DOMException named "AbortError".
+    // 6. Set the [[PromiseIsHandled]] internal slot of animation’s current ready promise to true.
     if (silently == Silently::No)
-        m_readyPromise->reject(Exception { AbortError });
+        m_readyPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
 
-    // 6. Let animation's current ready promise be the result of creating a new resolved Promise object.
+    // 7. Let animation's current ready promise be the result of creating a new resolved Promise object.
     m_readyPromise = makeUniqueRef<ReadyPromise>(*this, &WebAnimation::readyPromiseResolve);
     m_readyPromise->resolve(*this);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to