blob: 0e15ef4f3d2dc6ca2ec13059b621ebb5dfe53ec0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
add_task(async function test_bug_1572798() {
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
BrowserTestUtils.loadURIString(
tab.linkedBrowser,
"https://example.com/browser/toolkit/content/tests/browser/file_document_open_audio.html"
);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
let windowLoaded = BrowserTestUtils.waitForNewWindow();
info("- clicking button to spawn a new window -");
await ContentTask.spawn(tab.linkedBrowser, null, function () {
content.document.querySelector("button").click();
});
info("- waiting for the new window -");
let newWin = await windowLoaded;
info("- checking that the new window plays the audio -");
let documentOpenedBrowser = newWin.gBrowser.selectedBrowser;
await ContentTask.spawn(documentOpenedBrowser, null, async function () {
try {
await content.document.querySelector("audio").play();
ok(true, "Could play the audio");
} catch (e) {
ok(false, "Rejected audio promise" + e);
}
});
info("- Cleaning up -");
await BrowserTestUtils.closeWindow(newWin);
await BrowserTestUtils.removeTab(tab);
});
|