Mypal/dom/animation/test/mozilla/file_set-easing.html

35 lines
974 B
HTML

<!doctype html>
<head>
<meta charset=utf-8>
<title>Test setting easing in sandbox</title>
<script src="../testcommon.js"></script>
</head>
<body>
<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.timing.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.toSource()})()`, sandbox);
}, 'Setting easing should not throw any exceptions in sandbox');
done();
</script>
</body>