gecko-dev/dom/worklet/tests/test_import_with_cache.html

50 строки
1.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for Worklet</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="common.js"></script>
</head>
<body>
<script type="application/javascript">
function configureTest() {
return SpecialPowers.pushPrefEnv(
{"set": [["dom.audioworklet.enabled", true],
["dom.worklet.enabled", true]]});
}
// This function is called into an iframe.
function runTestInIframe() {
var audioContext = new AudioContext();
function loading() {
audioContext.audioWorklet.addModule("server_import_with_cache.sjs")
.then(() => {
ok(true, "Import should load a resource.");
}, () => {
ok(false, "Import should load a resource.");
})
.then(() => {
done();
});
}
var count = 0;
const MAX = 10;
function done() {
if (++count == MAX) {
SimpleTest.finish();
}
}
for (var i = 0; i < MAX; ++i) {
loading();
}
}
</script>
</body>
</html>