зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
622c7ee8f0
Коммит
124008414e
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче