tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

worklet-animation-with-invalid-effect.https.html (971B)


      1 <!DOCTYPE html>
      2 <title>Test that worklet animation with invalid effect cannot be played</title>
      3 <link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/web-animations/testcommon.js"></script>
      7 <script src="common.js"></script>
      8 
      9 <style>
     10 #target {
     11  width: 100px;
     12  height: 100px;
     13 }
     14 </style>
     15 
     16 <div id="target"></div>
     17 
     18 <script>
     19 'use strict';
     20 
     21 promise_test(async function() {
     22  await registerPassthroughAnimator();
     23  let playFunc = function() {
     24    let effect = new KeyframeEffect(
     25        document.getElementById('target'),
     26        [
     27          // No keyframe.
     28        ],
     29        { duration: 1000 }
     30    );
     31    let animation = new WorkletAnimation('passthrough', effect);
     32    animation.play();
     33  }
     34  assert_throws_dom('InvalidStateError', playFunc);
     35 }, 'Trying to play invalid worklet animation should throw an exception.');
     36 </script>