6 <p>Tests that we don't garbage collect playing audio object or event listener.
</p>
7 <p>According to http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html,
<br />
8 "4.8.10.8 Playing the media resource",
<br />
9 "Media elements must not stop playing just because all references to them have
10 been removed; only once a media element is in a state where no further audio
11 could ever be played by that element may the element be garbage collected."<br /><br />
12 (see https://bugs.webkit.org/show_bug.cgi?id=
66878, https://bugs.webkit.org/show_bug.cgi?id=
70421, and http://crbug.com/
62604 for more details).
</p>
14 FAIL: Test either still running or stopped prematurely.
17 <script src=../resources/gc.js
></script>
18 <script src=media-file.js
></script>
19 <script src=video-test.js
></script>
20 <script type=
"text/javascript">
26 document
.getElementById("result").innerText
= "PASS";
27 if (window
.testRunner
) {
28 testRunner
.notifyDone();
34 var audioFile
= findMediaFile("audio", "content/silence");
35 var a
= new Audio(audioFile
);
36 a
.addEventListener('ended', function() {
38 if (num_played
< play_times
) {
39 a
.currentTime
= a
.duration
- 0.35;
41 if (num_played
== play_times
- 1) {
54 waitForEvent('canplaythrough', function() {
55 a
.currentTime
= a
.duration
- 0.35;
57 }, false, true, a
, true);