Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /webaudio/the-audio-api/the-audiocontext-interface/audiocontext-state-change-after-close.http.window.html - WPT Dashboard Interop Dashboard
'use strict';
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.close(),
'A closed AudioContext should reject calls to close');
}, 'Call close on a closed AudioContext');
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.resume(),
'A closed AudioContext should reject calls to resume');
}, 'Call resume on a closed AudioContext');
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.suspend(),
'A closed AudioContext should reject calls to suspend');
}, 'Call suspend on a closed AudioContext');