<!DOCTYPE html>

<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/audio-testing.js"></script>
</head>

<body>
<div id="description"></div>
<div id="console"></div>

<script>
description("Tests garbage collection of MediaElementAudioSourceNode.");

function runTest() {
    if (window.testRunner) {
        testRunner.dumpAsText();
    }

    audioElement = document.createElement("audio");
    context = new AudioContext({ sampleRate: 44100 });
    source = context.createMediaElementSource(audioElement);
    audioElement = null;
    context = null;
    source = null;
    gc();

    testPassed("MediaElementAudioSourceNode survived garbage collection.");

    finishJSTest();
}

runTest();

</script>

<script src="../resources/js-test-post.js"></script>
</body>
</html>
