2017-12-14 00:50:20 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test GC for not-allow-to-start audio context</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2017-12-14 00:50:20 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
SimpleTest.requestFlakyTimeout(`Checking that something does not happen`);
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
var destId;
|
|
|
|
|
|
|
|
function observer(subject, topic, data) {
|
|
|
|
let id = parseInt(data);
|
|
|
|
ok(id != destId, "dropping another node, not the context's destination");
|
|
|
|
}
|
|
|
|
|
|
|
|
SpecialPowers.addAsyncObserver(observer, "webaudio-node-demise", false);
|
|
|
|
SimpleTest.registerCleanupFunction(function() {
|
|
|
|
SpecialPowers.removeAsyncObserver(observer, "webaudio-node-demise");
|
|
|
|
});
|
|
|
|
|
2018-06-29 16:14:33 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
|
2020-05-15 05:51:18 +03:00
|
|
|
["media.autoplay.blocking_policy", 0]]},
|
2017-12-14 00:50:20 +03:00
|
|
|
startTest);
|
|
|
|
|
|
|
|
function startTest() {
|
|
|
|
info("- create audio context -");
|
|
|
|
let ac = new AudioContext();
|
|
|
|
|
|
|
|
info("- get node Id -");
|
|
|
|
destId = SpecialPowers.getPrivilegedProps(ac.destination, "id");
|
|
|
|
|
|
|
|
info("- trigger GCs -");
|
|
|
|
SpecialPowers.forceGC();
|
|
|
|
SpecialPowers.forceCC();
|
|
|
|
SpecialPowers.forceGC();
|
|
|
|
|
|
|
|
info("- after three GCs -");
|
|
|
|
|
|
|
|
// We're doing this async so that we can receive observerservice messages.
|
|
|
|
setTimeout(function() {
|
|
|
|
ok(true, `AudioContext that has been prevented
|
|
|
|
from starting has correctly survived GC`)
|
|
|
|
SimpleTest.finish();
|
|
|
|
}, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|