summaryrefslogtreecommitdiffstats
path: root/dom/animation/test/mozilla/test_set_easing.html
blob: 55c77f0e8ffc8ef4da68db01e94a68acf94a183d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<head>
<meta charset=utf-8>
<title>Test setting easing in sandbox</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
"use strict";

test(function(t) {
  const div = document.createElement("div");
  document.body.appendChild(div);
  div.animate({ opacity: [0, 1] }, 100000 );

  const contentScript = function() {
    try {
      document.getAnimations()[0].effect.updateTiming({ easing: 'linear' });
      assert_true(true, 'Setting easing should not throw in sandbox');
    } catch (e) {
      assert_unreached('Setting easing threw ' + e);
    }
  };

  const sandbox = new SpecialPowers.Cu.Sandbox(window);
  sandbox.importFunction(document, "document");
  sandbox.importFunction(assert_true, "assert_true");
  sandbox.importFunction(assert_unreached, "assert_unreached");
  SpecialPowers.Cu.evalInSandbox(`(${contentScript.toString()})()`, sandbox);
}, 'Setting easing should not throw any exceptions in sandbox');

</script>
</body>