blob: 378bd9fb2fd49b3096f8959ae2d1840938f4e6a9 [file] [log] [blame]
<!DOCTYPE html>
<html>
<title>Test MediaSource object and objectUrl creation and revocation, with MediaSource in dedicated worker</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
// Fail fast if MSE-in-Workers is not supported.
assert_true(MediaSource.hasOwnProperty("canConstructInDedicatedWorker"), "MediaSource hasOwnProperty 'canConstructInDedicatedWorker'");
assert_true(MediaSource.canConstructInDedicatedWorker, "MediaSource.canConstructInDedicatedWorker");
let worker = new Worker("mediasource-worker-util.js");
worker.onmessage = t.step_func(e => {
if (e.data.substr(0,6) == "Error:") {
assert_unreached("Worker error: " + e.data);
} else {
const url = e.data;
assert_true(url.match(/^blob:.+/) != null);
URL.revokeObjectURL(url);
t.done();
}
});
}, "Test main context revocation of DedicatedWorker MediaSource object URL");
if (MediaSource.hasOwnProperty("canConstructInDedicatedWorker") && MediaSource.canConstructInDedicatedWorker === true) {
// If implementation claims support for MSE-in-Workers, then fetch and run
// some tests directly in another dedicated worker and get their results
// merged into those from this page.
fetch_tests_from_worker(new Worker("mediasource-worker-objecturl.js"));
} else {
// Otherwise, fetch and run a test that verifies lack of support of
// MediaSource construction in another dedicated worker.
fetch_tests_from_worker(new Worker("mediasource-worker-must-fail-if-unsupported.js"));
}
</script>
</html>