OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>GC while seeking</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <script> |
| 7 async_test(function(t) |
| 8 { |
| 9 var a = document.createElement("audio"); |
| 10 a.foo = "bar"; |
| 11 a.src = findMediaFile("audio", "content/test"); |
| 12 a.onsuspend = t.step_func(function() |
| 13 { |
| 14 assert_equals(a.networkState, a.NETWORK_IDLE); |
| 15 a.currentTime = a.duration / 2; |
| 16 assert_true(a.seeking); |
| 17 // Continue after a timeout since the current event target is the media |
| 18 // element, which means that it cannot be garbage collected now. |
| 19 setTimeout(t.step_func(gcAndAwaitSeeked), 0); |
| 20 }); |
| 21 function gcAndAwaitSeeked() |
| 22 { |
| 23 if (!a.seeking) { |
| 24 // The seek may have already completed, in which case it's too late |
| 25 // to verify GC behavior. Since networkState is NETWORK_IDLE there's |
| 26 // no way to make the seek slower, making this test inherently racy. |
| 27 t.done(); |
| 28 } else { |
| 29 a.onseeked = t.step_func(function(e) |
| 30 { |
| 31 assert_greater_than(e.target.currentTime, 0); |
| 32 assert_equals(e.target.foo, "bar"); |
| 33 t.done(); |
| 34 }); |
| 35 a = null; |
| 36 gc(); |
| 37 } |
| 38 } |
| 39 }); |
| 40 </script> |
OLD | NEW |