blob: 31f8b40bc907a17b72560666ef980dac21fcf84c [file] [log] [blame]
<!DOCTYPE html>
<title>GC while networkState is NETWORK_LOADING</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../../media-resources/media-file.js"></script>
<script>
async_test(function(t)
{
var v = document.createElement("video");
v.foo = "bar";
var mediaFile = "../../../media/content/test.ogv";
var type = mimeTypeForExtension(mediaFile.split(".").pop());
v.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + mediaFile + "&throttle=50&type=" + type;
v.onloadstart = t.step_func(function()
{
assert_equals(v.networkState, v.NETWORK_LOADING);
// The delaying-the-load-event flag is now false.
// Continue after a timeout since the current event target is the media
// element, which means that it cannot be garbage collected now.
setTimeout(t.step_func(gcAndAwaitProgress), 0);
});
function gcAndAwaitProgress()
{
v.onprogress = t.step_func(function(e)
{
assert_equals(e.target.foo, "bar");
t.done();
});
v = null;
gc();
}
});
</script>