tor-browser

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

browser_animation_simple.js (1383B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Simple checks for the AnimationsActor
      7 
      8 add_task(async function () {
      9  const { target, walker, animations } = await initAnimationsFrontForUrl(
     10    "data:text/html;charset=utf-8,<title>test</title><div></div>"
     11  );
     12 
     13  ok(animations, "The AnimationsFront was created");
     14  ok(
     15    animations.getAnimationPlayersForNode,
     16    "The getAnimationPlayersForNode method exists"
     17  );
     18  ok(animations.pauseSome, "The pauseSome method exists");
     19  ok(animations.playSome, "The playSome method exists");
     20  ok(animations.setCurrentTimes, "The setCurrentTimes method exists");
     21  ok(animations.setPlaybackRates, "The setPlaybackRates method exists");
     22  ok(animations.setWalkerActor, "The setWalkerActor method exists");
     23 
     24  let didThrow = false;
     25  try {
     26    await animations.getAnimationPlayersForNode(null);
     27  } catch (e) {
     28    didThrow = true;
     29  }
     30  ok(didThrow, "An exception was thrown for a missing NodeActor");
     31 
     32  const invalidNode = await walker.querySelector(walker.rootNode, "title");
     33  const players = await animations.getAnimationPlayersForNode(invalidNode);
     34  ok(Array.isArray(players), "An array of players was returned");
     35  is(players.length, 0, "0 players have been returned for the invalid node");
     36 
     37  await target.destroy();
     38  gBrowser.removeCurrentTab();
     39 });