Skip to content

Commit

Permalink
Sync media-element-enqueue-event-crash.html from Blink / Chromium u…
Browse files Browse the repository at this point in the history
…pstream

https://bugs.webkit.org/show_bug.cgi?id=270410

Reviewed by Jean-Yves Avenard.

This patch is to sync `media-element-enqueue-event-crash.html` from
Blink / Chromium upstream as per below latest commit:

Only change is to use `mp4` rather than `ogv`.

Partial Merge: https://source.chromium.org/chromium/chromium/src/+/2e0d99c0e86f5dc6624817f27ba76884f5cbbf83

* LayoutTests/media/track/media-element-enqueue-event-crash.html: Updated
* LayoutTests/media/track/media-element-enqueue-event-crash-expected.txt: Ditto

Canonical link: https://commits.webkit.org/275654@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Mar 4, 2024
1 parent 5e99c9e commit e651241
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Tests that appending events for dispatching doesn't crash

** No crash. Pass **
PASS Tests that appending events for dispatching doesn't crash.

100 changes: 41 additions & 59 deletions LayoutTests/media/track/media-element-enqueue-event-crash.html
Original file line number Diff line number Diff line change
@@ -1,60 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src=../video-test.js></script>
<script src=../../resources/gc.js></script>

<script>
if (window.testRunner)
{
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function startTest()
{
if (localStorage.testRuns)
localStorage.testRuns = Number(localStorage.testRuns) + 1;
else {
localStorage.testRuns = 1;
localStorage.totalRuns = 2;
}

document.getElementsByTagName('track')[0].track.mode = 'showing';
setTimeout(CFcrash, 100);
}

function forceGC() {
gc();

// End the test only if it ran at least totalRuns.
if (window.testRunner && localStorage.testRuns == localStorage.totalRuns) {
consoleWrite("** No crash. Pass **");
testRunner.notifyDone();
} else
window.location.reload();
}

function CFcrash()
{
document1 = document.implementation.createDocument("", null);
document1.appendChild(videoElement);
delete document1;

setTimeout(forceGC, 0);
}

document.addEventListener("DOMContentLoaded", startTest, false);
setCaptionDisplayMode('Automatic');
</script>
</head>

<body>
<p>Tests that appending events for dispatching doesn't crash</p>
<video autoplay id="videoElement">
<source src="../content/test.ogv">
<source src="../content/test.mp4">
<track src="captions-webvtt/captions-fast.vtt" default>
</video>
</body>
</html>
<title>Tests that appending events for dispatching doesn't crash.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gc.js"></script>
<video autoplay>
<track src="captions-webvtt/captions-fast.vtt" default>
</video>
<script>
async_test(function(t) {
if (localStorage.testRuns)
localStorage.testRuns = Number(localStorage.testRuns) + 1;
else {
localStorage.testRuns = 1;
localStorage.totalRuns = 5;
}

document.querySelector("track").track.mode = "showing";
setTimeout(t.step_func(CFcrash), 100);

function CFcrash() {
var video = document.querySelector("video");
video.src = "content/test.mp4";
var document1 = document.implementation.createDocument("", null);
document1.appendChild(video);
delete document1;

setTimeout(t.step_func(forceGC), 0);
}

function forceGC() {
gc();

// End the test only if it ran totalRuns.
if (localStorage.testRuns == localStorage.totalRuns)
t.done();
else
location.reload();
}

});
</script>

0 comments on commit e651241

Please sign in to comment.