forked from mirrors/gecko-dev
		
	This should make a bit clearer that it is only starting the load, not waiting for its completion. Differential Revision: https://phabricator.services.mozilla.com/D188213
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
const PAGE =
 | 
						|
  "https://example.com/browser/toolkit/content/tests/browser/file_webAudio.html";
 | 
						|
 | 
						|
// The tab closing code leaves an uncaught rejection. This test has been
 | 
						|
// whitelisted until the issue is fixed.
 | 
						|
if (!gMultiProcessBrowser) {
 | 
						|
  const { PromiseTestUtils } = ChromeUtils.importESModule(
 | 
						|
    "resource://testing-common/PromiseTestUtils.sys.mjs"
 | 
						|
  );
 | 
						|
  PromiseTestUtils.expectUncaughtRejection(/is no longer, usable/);
 | 
						|
}
 | 
						|
 | 
						|
add_task(async function setup_test_preference() {
 | 
						|
  await SpecialPowers.pushPrefEnv({
 | 
						|
    set: [
 | 
						|
      ["media.useAudioChannelService.testing", true],
 | 
						|
      ["media.block-autoplay-until-in-foreground", true],
 | 
						|
    ],
 | 
						|
  });
 | 
						|
});
 | 
						|
 | 
						|
add_task(async function block_web_audio() {
 | 
						|
  info("- open new background tab -");
 | 
						|
  let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
 | 
						|
  BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, PAGE);
 | 
						|
  await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 | 
						|
 | 
						|
  info("- tab should be blocked -");
 | 
						|
  await waitForTabBlockEvent(tab, true);
 | 
						|
 | 
						|
  info("- switch tab -");
 | 
						|
  await BrowserTestUtils.switchTab(window.gBrowser, tab);
 | 
						|
 | 
						|
  info("- tab should be resumed -");
 | 
						|
  await waitForTabBlockEvent(tab, false);
 | 
						|
 | 
						|
  info("- tab should be audible -");
 | 
						|
  await waitForTabPlayingEvent(tab, true);
 | 
						|
 | 
						|
  info("- remove tab -");
 | 
						|
  BrowserTestUtils.removeTab(tab);
 | 
						|
});
 |