Bug 1694941, wait for sound to start playing before treating a sound-playing tab as ready, r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D123746
This commit is contained in:
Neil Deakin 2021-08-27 01:31:38 +00:00
Родитель 622c7ee8f0
Коммит 124008414e
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -9,10 +9,25 @@ const BASE_URL = "https://example.com/browser/browser/modules/test/browser/";
async function play(tab) {
let browser = tab.linkedBrowser;
let waitForAudioPromise = BrowserTestUtils.waitForEvent(
tab,
"TabAttrModified",
false,
event => {
return (
event.detail.changed.includes("soundplaying") &&
tab.hasAttribute("soundplaying")
);
}
);
await SpecialPowers.spawn(browser, [], async function() {
let audio = content.document.querySelector("audio");
await audio.play();
});
await waitForAudioPromise;
}
async function addTab(win = window) {