зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451913 P8 Add an AudioContext event target leak test. r=smaug
This commit is contained in:
Родитель
d53119ba20
Коммит
dab3fba304
|
@ -11,6 +11,7 @@ support-files =
|
|||
audiovideo.mp4
|
||||
audioBufferSourceNodeDetached_worker.js
|
||||
corsServer.sjs
|
||||
!/dom/events/test/event_leak_utils.js
|
||||
file_nodeCreationDocumentGone.html
|
||||
invalid.txt
|
||||
layouttest-glue.js
|
||||
|
@ -152,6 +153,7 @@ skip-if = toolkit == 'android' # bug 1056706
|
|||
[test_dynamicsCompressorNode.html]
|
||||
[test_dynamicsCompressorNodePassThrough.html]
|
||||
[test_dynamicsCompressorNodeWithGain.html]
|
||||
[test_event_listener_leaks.html]
|
||||
[test_gainNode.html]
|
||||
[test_gainNodeInLoop.html]
|
||||
[test_gainNodePassThrough.html]
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1450358 - Test AudioContext event listener leak conditions</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/dom/events/test/event_leak_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
// Manipulate AudioContext objects in the frame's context.
|
||||
// Its important here that we create a listener callback from
|
||||
// the DOM objects back to the frame's global in order to
|
||||
// exercise the leak condition.
|
||||
async function useAudioContext(contentWindow) {
|
||||
let ctx = new contentWindow.AudioContext();
|
||||
ctx.onstatechange = e => {
|
||||
contentWindow.stateChangeCount += 1;
|
||||
};
|
||||
|
||||
let osc = ctx.createOscillator();
|
||||
osc.type = "sine";
|
||||
osc.frequency.value = 440;
|
||||
osc.start();
|
||||
}
|
||||
|
||||
async function runTest() {
|
||||
try {
|
||||
await checkForEventListenerLeaks("AudioContext", useAudioContext);
|
||||
} catch (e) {
|
||||
ok(false, e);
|
||||
} finally {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addEventListener("load", runTest, { once: true });
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче