Changeset 258702 in webkit


Ignore:
Timestamp:
Mar 19, 2020 9:42:24 AM (4 years ago)
Author:
commit-queue@webkit.org
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 <Antoine Quint> 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):

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r258661 r258702  
     12020-03-19  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Mark promises as handled when rejected
     4        https://bugs.webkit.org/show_bug.cgi?id=209240
     5        <rdar://problem/60592305>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Add the new WPT tests added for this spec change (https://github.com/web-platform-tests/wpt/pull/22314) and revert some workarounds
     10        made in our copy of WPT tests to previously silence flaky console output related to promise rejections (added in r258275 and r258276).
     11
     12        * web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt:
     13        * web-platform-tests/web-animations/interfaces/Animation/finished.html:
     14        * web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt:
     15        * web-platform-tests/web-animations/interfaces/Animation/ready.html:
     16        * web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html:
     17        * web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html:
     18
    1192020-03-18  Frank Yang  <guowei_yang@apple.com>
    220
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt

    r233584 r258702  
    2121PASS Finished promise should be resolved after the ready promise is resolved
    2222PASS Finished promise should be rejected after the ready promise is rejected
     23PASS Finished promise does not report an unhandledrejection when rejected
    2324
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finished.html

    r237857 r258702  
    396396}, 'Finished promise should be rejected after the ready promise is rejected');
    397397
     398promise_test(async t => {
     399  const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
     400
     401  // Ensure the finished promise is created
     402  const finished = animation.finished;
     403
     404  window.addEventListener(
     405    'unhandledrejection',
     406    t.unreached_func('Should not get an unhandled rejection')
     407  );
     408
     409  animation.cancel();
     410
     411  // Wait a moment to allow a chance for the event to be dispatched.
     412  await waitForAnimationFrames(2);
     413}, 'Finished promise does not report an unhandledrejection when rejected');
     414
    398415</script>
    399416</body>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready-expected.txt

    r227598 r258702  
    33PASS Redundant calls to play() do not generate new ready promise objects
    44PASS The ready promise is fulfilled with its Animation
     5PASS The ready promise does not report an unhandledrejection when rejected
    56
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html

    r237857 r258702  
    5858}, 'The ready promise is fulfilled with its Animation');
    5959
     60promise_test(async t => {
     61  const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
     62
     63  // Ensure the ready promise is created
     64  const ready = animation.ready;
     65
     66  window.addEventListener(
     67    'unhandledrejection',
     68    t.unreached_func('Should not get an unhandled rejection')
     69  );
     70
     71  animation.cancel();
     72
     73  // Wait a moment to allow a chance for the event to be dispatched.
     74  await waitForAnimationFrames(2);
     75}, 'The ready promise does not report an unhandledrejection when rejected');
     76
    6077</script>
    6178</body>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html

    r258275 r258702  
    305305  await animation.ready;
    306306
    307   const originalFinishPromise = animation.finished.catch(() => {});
     307  const originalFinishPromise = animation.finished;
    308308
    309309  animation.cancel();
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/pausing-an-animation.html

    r258276 r258702  
    9595  const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
    9696
    97   const originalReadyPromise = animation.ready.catch(() => {});
     97  const originalReadyPromise = animation.ready;
    9898  animation.cancel();
    9999  assert_equals(animation.startTime, null);
  • trunk/Source/WebCore/ChangeLog

    r258698 r258702  
     12020-03-19  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Mark promises as handled when rejected
     4        https://bugs.webkit.org/show_bug.cgi?id=209240
     5        <rdar://problem/60592305>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Implementing the spec change discussed in https://github.com/w3c/csswg-drafts/issues/4556.
     10
     11        * animation/WebAnimation.cpp:
     12        (WebCore::WebAnimation::cancel):
     13        (WebCore::WebAnimation::resetPendingTasks):
     14
    1152020-03-19  Charlie Turner  <cturner@igalia.com>
    216
  • trunk/Source/WebCore/animation/WebAnimation.cpp

    r258274 r258702  
    633633
    634634        // 2. Reject the current finished promise with a DOMException named "AbortError".
     635        // 3. Set the [[PromiseIsHandled]] internal slot of the current finished promise to true.
    635636        if (silently == Silently::No && !m_finishedPromise->isFulfilled())
    636             m_finishedPromise->reject(Exception { AbortError });
    637 
    638         // 3. Let current finished promise be a new (pending) Promise object.
     637            m_finishedPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
     638
     639        // 4. Let current finished promise be a new (pending) Promise object.
    639640        m_finishedPromise = makeUniqueRef<FinishedPromise>(*this, &WebAnimation::finishedPromiseResolve);
    640641
    641         // 4. Create an AnimationPlaybackEvent, cancelEvent.
    642         // 5. Set cancelEvent's type attribute to cancel.
    643         // 6. Set cancelEvent's currentTime to null.
    644         // 7. Let timeline time be the current time of the timeline with which animation is associated. If animation is not associated with an
     642        // 5. Create an AnimationPlaybackEvent, cancelEvent.
     643        // 6. Set cancelEvent's type attribute to cancel.
     644        // 7. Set cancelEvent's currentTime to null.
     645        // 8. Let timeline time be the current time of the timeline with which animation is associated. If animation is not associated with an
    645646        //    active timeline, let timeline time be n unresolved time value.
    646         // 8. Set cancelEvent's timelineTime to timeline time. If timeline time is unresolved, set it to null.
    647         // 9. If animation has a document for timing, then append cancelEvent to its document for timing's pending animation event queue along
     647        // 9. Set cancelEvent's timelineTime to timeline time. If timeline time is unresolved, set it to null.
     648        // 10. If animation has a document for timing, then append cancelEvent to its document for timing's pending animation event queue along
    648649        //    with its target, animation. If animation is associated with an active timeline that defines a procedure to convert timeline times
    649650        //    to origin-relative time, let the scheduled event time be the result of applying that procedure to timeline time. Otherwise, the
     
    717718
    718719    // 5. Reject animation's current ready promise with a DOMException named "AbortError".
     720    // 6. Set the [[PromiseIsHandled]] internal slot of animation’s current ready promise to true.
    719721    if (silently == Silently::No)
    720         m_readyPromise->reject(Exception { AbortError });
    721 
    722     // 6. Let animation's current ready promise be the result of creating a new resolved Promise object.
     722        m_readyPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
     723
     724    // 7. Let animation's current ready promise be the result of creating a new resolved Promise object.
    723725    m_readyPromise = makeUniqueRef<ReadyPromise>(*this, &WebAnimation::readyPromiseResolve);
    724726    m_readyPromise->resolve(*this);
Note: See TracChangeset for help on using the changeset viewer.