Index: LayoutTests/http/tests/media/gc-while-network-loading.html |
diff --git a/LayoutTests/http/tests/media/gc-while-network-loading.html b/LayoutTests/http/tests/media/gc-while-network-loading.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..caf03b4bf6bad64cb28defdae1a5716f7d423d91 |
--- /dev/null |
+++ b/LayoutTests/http/tests/media/gc-while-network-loading.html |
@@ -0,0 +1,33 @@ |
+<!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 = findMediaFile("video", "../../../media/content/test"); |
+ 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.onloadeddata = 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> |