Layout Test media/W3C/audio/events/event_progress.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=181966
<rdar://problem/51449034>
Patch by Peng Liu <peng.liu6@apple.com> on 2019-10-11
Reviewed by Alexey Proskuryakov.
Use the option {once: true} in addEventListener instead of a variable to avoid
executing the event handler more than once.
* media/W3C/audio/events/event_order_loadstart_progress.html:
* media/W3C/audio/events/event_progress.html:
* media/W3C/audio/events/event_progress_manual.html:
* media/W3C/video/events/event_order_loadstart_progress.html:
* media/W3C/video/events/event_progress.html:
* media/W3C/video/events/event_progress_manual.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5eedb46..1da793b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2019-10-11 Peng Liu <peng.liu6@apple.com>
+
+ Layout Test media/W3C/audio/events/event_progress.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=181966
+ <rdar://problem/51449034>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use the option {once: true} in addEventListener instead of a variable to avoid
+ executing the event handler more than once.
+
+ * media/W3C/audio/events/event_order_loadstart_progress.html:
+ * media/W3C/audio/events/event_progress.html:
+ * media/W3C/audio/events/event_progress_manual.html:
+ * media/W3C/video/events/event_order_loadstart_progress.html:
+ * media/W3C/video/events/event_progress.html:
+ * media/W3C/video/events/event_progress_manual.html:
+
2019-10-11 Dean Jackson <dino@apple.com>
Layout Test fast/events/touch/ios/tap-with-passive-listener-inside-active-listener.html is a Flaky Failure
diff --git a/LayoutTests/media/W3C/audio/events/event_order_loadstart_progress.html b/LayoutTests/media/W3C/audio/events/event_order_loadstart_progress.html
index 608ea5b..a65963f 100644
--- a/LayoutTests/media/W3C/audio/events/event_order_loadstart_progress.html
+++ b/LayoutTests/media/W3C/audio/events/event_order_loadstart_progress.html
@@ -17,17 +17,13 @@
found_loadstart = true;
});
-var firstProgressEvent = true;
a.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
-
t.step(function() {
assert_true(found_loadstart);
});
t.done();
a.pause();
-});
+}, { once: true });
a.src = getAudioURI();
</script>
</body>
diff --git a/LayoutTests/media/W3C/audio/events/event_progress.html b/LayoutTests/media/W3C/audio/events/event_progress.html
index e04cfc2..2f7c830 100644
--- a/LayoutTests/media/W3C/audio/events/event_progress.html
+++ b/LayoutTests/media/W3C/audio/events/event_progress.html
@@ -12,17 +12,13 @@
<script>
var t = async_test("setting src attribute on autoplay video should trigger progress event", {timeout:30000});
var a = document.getElementById("a");
-var firstProgressEvent = true;
-
a.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
t.step(function() {
assert_true(true);
});
t.done();
a.pause();
-});
+}, { once: true });
a.src = getAudioURI();
</script>
</body>
diff --git a/LayoutTests/media/W3C/audio/events/event_progress_manual.html b/LayoutTests/media/W3C/audio/events/event_progress_manual.html
index bac3757..8b7d3bf 100644
--- a/LayoutTests/media/W3C/audio/events/event_progress_manual.html
+++ b/LayoutTests/media/W3C/audio/events/event_progress_manual.html
@@ -12,17 +12,12 @@
<script>
var t = async_test("setting src attribute on non-autoplay video should trigger progress event", {timeout:30000});
var a = document.getElementById("a");
-
-var firstProgressEvent = true;
a.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
-
t.step(function() {
assert_true(true);
});
t.done();
-});
+}, { once: true});
a.src = getAudioURI();
</script>
</body>
diff --git a/LayoutTests/media/W3C/video/events/event_order_loadstart_progress.html b/LayoutTests/media/W3C/video/events/event_order_loadstart_progress.html
index 5f44ba8..75b9c85 100644
--- a/LayoutTests/media/W3C/video/events/event_order_loadstart_progress.html
+++ b/LayoutTests/media/W3C/video/events/event_order_loadstart_progress.html
@@ -17,16 +17,13 @@
found_loadstart = true;
});
-var firstProgressEvent = true;
v.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
t.step(function() {
assert_true(found_loadstart);
});
t.done();
v.pause();
-});
+}, { once: true });
v.src = getVideoURI();
</script>
</body>
diff --git a/LayoutTests/media/W3C/video/events/event_progress.html b/LayoutTests/media/W3C/video/events/event_progress.html
index 9d5312f..6a823f7 100644
--- a/LayoutTests/media/W3C/video/events/event_progress.html
+++ b/LayoutTests/media/W3C/video/events/event_progress.html
@@ -12,18 +12,13 @@
<script>
var t = async_test("setting src attribute on autoplay video should trigger progress event", {timeout:30000});
var v = document.getElementById("v");
-
-var firstProgressEvent = true;
v.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
-
t.step(function() {
assert_true(true);
});
t.done();
v.pause();
-});
+}, { once: true });
v.src = getVideoURI();
</script>
</body>
diff --git a/LayoutTests/media/W3C/video/events/event_progress_manual.html b/LayoutTests/media/W3C/video/events/event_progress_manual.html
index 157f5b3..2c03f1c 100644
--- a/LayoutTests/media/W3C/video/events/event_progress_manual.html
+++ b/LayoutTests/media/W3C/video/events/event_progress_manual.html
@@ -12,17 +12,12 @@
<script>
var t = async_test("setting src attribute on non-autoplay video should trigger progress event", {timeout:30000});
var v = document.getElementById("v");
-
-var firstProgressEvent = true;
v.addEventListener("progress", function() {
- if (!firstProgressEvent) return;
- firstProgressEvent = false;
-
t.step(function() {
assert_true(true);
});
t.done();
-});
+}, { once: true });
v.src = getVideoURI();
</script>
</body>