test_AudioContext_disabled.html (1393B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test whether we can disable the AudioContext interface</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="text/javascript" src="webaudio.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <pre id="test"> 11 <script class="testbody" type="text/javascript"> 12 13 const webaudio_interfaces = [ 14 "AudioContext", 15 "OfflineAudioContext", 16 "AudioContext", 17 "OfflineAudioCompletionEvent", 18 "AudioNode", 19 "AudioDestinationNode", 20 "AudioParam", 21 "GainNode", 22 "DelayNode", 23 "AudioBuffer", 24 "AudioBufferSourceNode", 25 "MediaElementAudioSourceNode", 26 "ScriptProcessorNode", 27 "AudioProcessingEvent", 28 "PannerNode", 29 "AudioListener", 30 "StereoPannerNode", 31 "ConvolverNode", 32 "AnalyserNode", 33 "ChannelSplitterNode", 34 "ChannelMergerNode", 35 "DynamicsCompressorNode", 36 "BiquadFilterNode", 37 "IIRFilterNode", 38 "WaveShaperNode", 39 "OscillatorNode", 40 "PeriodicWave", 41 "MediaStreamAudioSourceNode", 42 "MediaStreamAudioDestinationNode" 43 ]; 44 45 SimpleTest.waitForExplicitFinish(); 46 addLoadEvent(function() { 47 SpecialPowers.pushPrefEnv({"set": [["dom.webaudio.enabled", false]]}, function() { 48 webaudio_interfaces.forEach((e) => ok(!window[e], e + " must be disabled when the Web Audio API is disabled")); 49 SimpleTest.finish(); 50 }); 51 }); 52 53 </script> 54 </pre> 55 </body> 56 </html>