gecko-dev/toolkit/content/tests/browser/file_document_open_audio.html
Emilio Cobos Álvarez 80755ed700 Bug 1572798 - Should call MaybeActiveMediaComponents from SetScriptGlobalObject if becoming visible. r=bzbarsky,farre
Windows start blocking media by default (see the
media.block-autoplay-until-in-foreground pref).

If the document becomes visible from GetScriptHandlingObject(), we
hand-rolled our own UpdateVisibilityState and didn't call
MaybeActiveMediaComponents (which unblocks media playback).

It couldn't call it there before since given content docshells used
start as active, but now that they don't we can do that and fix the bug.

Differential Revision: https://phabricator.services.mozilla.com/D41438
2021-01-22 05:45:52 +00:00

11 lines
420 B
HTML

<!doctype html>
<title>Test for bug 1572798</title>
<script>
function openVideo() {
var w = window.open('', '', 'width = 640, height = 480, scrollbars=yes, menubar=no, toolbar=no, resizable=yes');
w.document.open();
w.document.write('<!DOCTYPE html><title>test popup</title><audio controls src="audio.ogg"></audio>');
w.document.close();
}
</script>
<button onclick="openVideo()">Open video</button>