tor-browser

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

test_set_easing.html (1103B)


      1 <!doctype html>
      2 <head>
      3 <meta charset=utf-8>
      4 <title>Test setting easing in sandbox</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="../testcommon.js"></script>
      8 </head>
      9 <body>
     10 <div id="log"></div>
     11 <script>
     12 "use strict";
     13 
     14 test(function(t) {
     15  const div = document.createElement("div");
     16  document.body.appendChild(div);
     17  div.animate({ opacity: [0, 1] }, 100000 );
     18 
     19  const contentScript = function() {
     20    try {
     21      document.getAnimations()[0].effect.updateTiming({ easing: 'linear' });
     22      assert_true(true, 'Setting easing should not throw in sandbox');
     23    } catch (e) {
     24      assert_unreached('Setting easing threw ' + e);
     25    }
     26  };
     27 
     28  const sandbox = new SpecialPowers.Cu.Sandbox(window);
     29  sandbox.importFunction(document, "document");
     30  sandbox.importFunction(assert_true, "assert_true");
     31  sandbox.importFunction(assert_unreached, "assert_unreached");
     32  SpecialPowers.Cu.evalInSandbox(`(${contentScript.toString()})()`, sandbox);
     33 }, 'Setting easing should not throw any exceptions in sandbox');
     34 
     35 </script>
     36 </body>