Bug 1472095 - Update the web-platform-tests for the Web Audio API to expect the right kind of type error. r=bz draft
authorPaul Adenot <paul@paul.cx>
Wed, 04 Jul 2018 16:57:37 +0200
changeset 817854 46f1a3c51305c2e015b2f62e8eb8c99efaa91b26
parent 817823 e2a78a2a3cd488cfef81e739aa20a7ff03b84616
push id116188
push userpaul@paul.cx
push dateFri, 13 Jul 2018 15:18:04 +0000
reviewersbz
bugs1472095
milestone63.0a1
Bug 1472095 - Update the web-platform-tests for the Web Audio API to expect the right kind of type error. r=bz This is the result of an execution of: > find testing/web-platform/tests/webaudio/the-audio-api -exec sed -i "s/'TypeError'/TypeError/" {} \; MozReview-Commit-ID: 8T0RoOobxJW
testing/web-platform/tests/webaudio/resources/audionodeoptions.js
testing/web-platform/tests/webaudio/resources/start-stop-exceptions.js
testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html
testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html
testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html
testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html
testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html
testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html
testing/web-platform/tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html
testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html
testing/web-platform/tests/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html
testing/web-platform/tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html
testing/web-platform/tests/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html
--- a/testing/web-platform/tests/webaudio/resources/audionodeoptions.js
+++ b/testing/web-platform/tests/webaudio/resources/audionodeoptions.js
@@ -35,17 +35,17 @@ function testAudioNodeOptions(should, co
         () => {
           node = new window[nodeName](
               context,
               Object.assign(
                   {}, expectedNodeOptions.additionalOptions,
                   {channelCount: testChannelCount}));
         },
         'new ' + nodeName + '(c, {channelCount: ' + testChannelCount + '}}')
-        .throw(expectedNodeOptions.channelCount.errorType || 'TypeError');
+        .throw(expectedNodeOptions.channelCount.errorType || TypeError);
   } else {
     // The channel count is not fixed.  Try to set the count to invalid
     // values and make sure an error is thrown.
     let errorType = 'NotSupportedError';
 
     [0, 99].forEach(testValue => {
       should(() => {
         node = new window[nodeName](
@@ -114,17 +114,17 @@ function testAudioNodeOptions(should, co
         () => {
           node = new window[nodeName](
               context,
               Object.assign(
                   {}, expectedNodeOptions.additionalOptions,
                   {channelCountMode: 'foobar'}));
         },
         'new ' + nodeName + '(c, {channelCountMode: "foobar"}')
-        .throw('TypeError');
+        .throw(TypeError);
     should(node.channelCountMode, 'node.channelCountMode after invalid setter')
         .beEqualTo(testValues[testValues.length - 1]);
   }
 
   // Test channelInterpretation
   if (expectedNodeOptions.channelInterpretation &&
       expectedNodeOptions.channelInterpretation.isFixed) {
     // The channel interpretation is fixed.  Verify that we throw an
@@ -176,17 +176,17 @@ function testAudioNodeOptions(should, co
         () => {
           node = new window[nodeName](
               context,
               Object.assign(
                   {}, expectedNodeOptions.additionalOptions,
                   {channelInterpretation: 'foobar'}));
         },
         'new ' + nodeName + '(c, {channelInterpretation: "foobar"})')
-        .throw('TypeError');
+        .throw(TypeError);
     should(
         node.channelInterpretation,
         'node.channelInterpretation after invalid setter')
         .beEqualTo('discrete');
   }
 }
 
 function initializeContext(should) {
@@ -196,23 +196,23 @@ function initializeContext(should) {
   }, 'context = new OfflineAudioContext(...)').notThrow();
 
   return c;
 }
 
 function testInvalidConstructor(should, name, context) {
   should(() => {
     new window[name]();
-  }, 'new ' + name + '()').throw('TypeError');
+  }, 'new ' + name + '()').throw(TypeError);
   should(() => {
     new window[name](1);
-  }, 'new ' + name + '(1)').throw('TypeError');
+  }, 'new ' + name + '(1)').throw(TypeError);
   should(() => {
     new window[name](context, 42);
-  }, 'new ' + name + '(context, 42)').throw('TypeError');
+  }, 'new ' + name + '(context, 42)').throw(TypeError);
 }
 
 function testDefaultConstructor(should, name, context, options) {
   let node;
 
   let message = options.prefix + ' = new ' + name + '(context';
   if (options.constructorOptions)
     message += ', ' + JSON.stringify(options.constructorOptions);
--- a/testing/web-platform/tests/webaudio/resources/start-stop-exceptions.js
+++ b/testing/web-platform/tests/webaudio/resources/start-stop-exceptions.js
@@ -3,17 +3,17 @@
 function testStartStop(should, node, options) {
   // Test non-finite values for start.  These should all throw a TypeError
   const nonFiniteValues = [NaN, Infinity, -Infinity];
 
   nonFiniteValues.forEach(time => {
       should(() => {
         node.start(time);
       }, `start(${time})`)
-    .throw('TypeError');
+    .throw(TypeError);
     });
 
   should(() => {
     node.stop();
   }, 'Calling stop() before start()').throw('InvalidStateError');
 
   should(() => {
     node.start(-1);
@@ -34,12 +34,12 @@ function testStartStop(should, node, opt
     node.stop(-1);
   }, 'stop(-1)').throw('RangeError');
 
   // Test non-finite stop times
   nonFiniteValues.forEach(time => {
       should(() => {
         node.stop(time);
       }, `stop(${time})`)
-    .throw('TypeError');
+    .throw(TypeError);
     });
 }
 
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel.html
@@ -116,20 +116,20 @@
               buffer = context.createBuffer(
                   numberOfChannels, bufferLength, context.sampleRate);
             },
             '0: buffer = context.createBuffer(' + numberOfChannels + ', ' +
                 bufferLength + ', context.sampleRate)')
             .notThrow();
         should(() => {
           buffer.copyFromChannel(null, 0);
-        }, '1: buffer.copyFromChannel(null, 0)').throw('TypeError');
+        }, '1: buffer.copyFromChannel(null, 0)').throw(TypeError);
         should(() => {
           buffer.copyFromChannel(context, 0);
-        }, '2: buffer.copyFromChannel(context, 0)').throw('TypeError');
+        }, '2: buffer.copyFromChannel(context, 0)').throw(TypeError);
         should(() => {
           buffer.copyFromChannel(x, -1);
         }, '3: buffer.copyFromChannel(x, -1)').throw('IndexSizeError');
         should(
             () => {
               buffer.copyFromChannel(x, numberOfChannels);
             },
             '4: buffer.copyFromChannel(x, ' + numberOfChannels + ')')
@@ -151,41 +151,41 @@
 
         if (window.SharedArrayBuffer) {
           let shared_buffer = new Float32Array(new SharedArrayBuffer(32));
           should(
               () => {
                 buffer.copyFromChannel(shared_buffer, 0);
               },
               '8: buffer.copyFromChannel(SharedArrayBuffer view, 0)')
-              .throw('TypeError');
+              .throw(TypeError);
 
           should(
               () => {
                 buffer.copyFromChannel(shared_buffer, 0, 0);
               },
               '9: buffer.copyFromChannel(SharedArrayBuffer view, 0, 0)')
-              .throw('TypeError');
+              .throw(TypeError);
         }
 
         task.done();
       });
 
       // Test that expected exceptions are signaled for copyTo.
       audit.define('copyTo-exceptions', (task, should) => {
         should(
             AudioBuffer.prototype.copyToChannel,
             'AudioBuffer.prototype.copyToChannel')
             .exist();
         should(() => {
           buffer.copyToChannel(null, 0);
-        }, '0: buffer.copyToChannel(null, 0)').throw('TypeError');
+        }, '0: buffer.copyToChannel(null, 0)').throw(TypeError);
         should(() => {
           buffer.copyToChannel(context, 0);
-        }, '1: buffer.copyToChannel(context, 0)').throw('TypeError');
+        }, '1: buffer.copyToChannel(context, 0)').throw(TypeError);
         should(() => {
           buffer.copyToChannel(x, -1);
         }, '2: buffer.copyToChannel(x, -1)').throw('IndexSizeError');
         should(
             () => {
               buffer.copyToChannel(x, numberOfChannels);
             },
             '3: buffer.copyToChannel(x, ' + numberOfChannels + ')')
@@ -206,24 +206,24 @@
 
         if (window.SharedArrayBuffer) {
           let shared_buffer = new Float32Array(new SharedArrayBuffer(32));
           should(
               () => {
                 buffer.copyToChannel(shared_buffer, 0);
               },
               '7: buffer.copyToChannel(SharedArrayBuffer view, 0)')
-              .throw('TypeError');
+              .throw(TypeError);
 
           should(
               () => {
                 buffer.copyToChannel(shared_buffer, 0, 0);
               },
               '8: buffer.copyToChannel(SharedArrayBuffer view, 0, 0)')
-              .throw('TypeError');
+              .throw(TypeError);
         }
 
         task.done();
       });
 
       // Test copyFromChannel
       audit.define('copyFrom-validate', (task, should) => {
         // Initialize the AudioBuffer to a ramp for testing copyFrom.
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer.html
@@ -19,47 +19,47 @@
       audit.define('initialize', (task, should) => {
         context = initializeContext(should);
         task.done();
       });
 
       audit.define('invalid constructor', (task, should) => {
         should(() => {
           new AudioBuffer();
-        }, 'new AudioBuffer()').throw('TypeError');
+        }, 'new AudioBuffer()').throw(TypeError);
         should(() => {
           new AudioBuffer(1);
-        }, 'new AudioBuffer(1)').throw('TypeError');
+        }, 'new AudioBuffer(1)').throw(TypeError);
         should(() => {
           new AudioBuffer(Date, 42);
-        }, 'new AudioBuffer(Date, 42)').throw('TypeError');
+        }, 'new AudioBuffer(Date, 42)').throw(TypeError);
 
         task.done();
       });
 
       audit.define('required options', (task, should) => {
         let buffer;
 
         // The length and sampleRate attributes are required; all others are
         // optional.
         should(() => {
           new AudioBuffer({});
-        }, 'buffer = new AudioBuffer({})').throw('TypeError');
+        }, 'buffer = new AudioBuffer({})').throw(TypeError);
 
         should(() => {
           new AudioBuffer({length: 1});
-        }, 'buffer = new AudioBuffer({length: 1})').throw('TypeError');
+        }, 'buffer = new AudioBuffer({length: 1})').throw(TypeError);
 
         should(() => {
           new AudioBuffer({sampleRate: 48000});
-        }, 'buffer = new AudioBuffer({sampleRate: 48000})').throw('TypeError');
+        }, 'buffer = new AudioBuffer({sampleRate: 48000})').throw(TypeError);
 
         should(() => {
           buffer = new AudioBuffer({numberOfChannels: 1});
-        }, 'buffer = new AudioBuffer({numberOfChannels: 1}').throw('TypeError');
+        }, 'buffer = new AudioBuffer({numberOfChannels: 1}').throw(TypeError);
 
         // Length and sampleRate are required, but others are optional.
         should(
             () => {
               buffer =
                   new AudioBuffer({length: 21, sampleRate: context.sampleRate});
             },
             'buffer0 = new AudioBuffer({length: 21, sampleRate: ' +
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
@@ -23,17 +23,17 @@
           },
           function(task, should) {
             context = new AudioContext();
             source = context.createBufferSource();
 
             // Make sure we can't set to something which isn't an AudioBuffer.
             should(function() {
               source.buffer = 57;
-            }, 'source.buffer = 57').throw('TypeError');
+            }, 'source.buffer = 57').throw(TypeError);
 
             // It's ok to set the buffer to null.
             should(function() {
               source.buffer = null;
             }, 'source.buffer = null').notThrow();
 
             // Set the buffer to a valid AudioBuffer
             let buffer =
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html
@@ -135,26 +135,26 @@
             closingPromises.push(context2.close());
 
             // Verify that invalid latencyHint values are rejected.
             should(
                 function() {
                   context = new AudioContext({'latencyHint': 'foo'})
                 },
                 'context = new AudioContext({\'latencyHint\': \'foo\'})')
-                .throw('TypeError');
+                .throw(TypeError);
 
             // Verify that no extra options can be passed into the
             // AudioContextOptions.
             should(
                 function() {
                   context = new AudioContext('latencyHint')
                 },
                 'context = new AudioContext(\'latencyHint\')')
-                .throw('TypeError');
+                .throw(TypeError);
 
             Promise.all(closingPromises).then(function() {
               task.done();
             });
           });
 
       audit.run();
     </script>
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
@@ -41,21 +41,21 @@
             should(
                 context.destination.numberOfOutputs,
                 'AudioContext.destination.numberOfOutputs')
                 .beEqualTo(0);
 
             // Try calling connect() method with illegal values.
             should(
                 () => audioNode.connect(0, 0, 0), 'audioNode.connect(0, 0, 0)')
-                .throw('TypeError');
+                .throw(TypeError);
             should(
                 () => audioNode.connect(null, 0, 0),
                 'audioNode.connect(null, 0, 0)')
-                .throw('TypeError');
+                .throw(TypeError);
             should(
                 () => audioNode.connect(context.destination, 5, 0),
                 'audioNode.connect(context.destination, 5, 0)')
                 .throw('IndexSizeError');
             should(
                 () => audioNode.connect(context.destination, 0, 5),
                 'audioNode.connect(context.destination, 0, 5)')
                 .throw('IndexSizeError');
@@ -72,17 +72,17 @@
                 () => window.audioNode.connect(context2.destination),
                 'Connecting a node to a different context')
                 .throw('InvalidAccessError');
 
             // 3-arg AudioContext doesn't create an offline context anymore.
             should(
                 () => context3 = new AudioContext(1, 44100, 44100),
                 'context3 = new AudioContext(1, 44100, 44100)')
-                .throw('TypeError');
+                .throw(TypeError);
 
             // Ensure it is an EventTarget
             should(
                 audioNode instanceof EventTarget, 'AudioNode is an EventTarget')
                 .beTrue();
 
             task.done();
           });
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exceptional-values.html
@@ -40,17 +40,17 @@
           (task, should) => {
             let gain = context.createGain();
 
             // Default method for generating the arguments for an automation
             // method for testing the value of the automation.
             let defaultFuncArg = (value) => [value, 1];
 
             // Test the value parameter
-            doTests(should, gain, 'TypeError', nonFiniteValues, [
+            doTests(should, gain, TypeError, nonFiniteValues, [
               {automationName: 'setValueAtTime', funcArg: defaultFuncArg}, {
                 automationName: 'linearRampToValueAtTime',
                 funcArg: defaultFuncArg
               },
               {
                 automationName: 'exponentialRampToValueAtTime',
                 funcArg: defaultFuncArg
               },
@@ -70,17 +70,17 @@
           (task, should) => {
             let gain = context.createGain();
 
             // Default method for generating the arguments for an automation
             // method for testing the time parameter of the automation.
             let defaultFuncArg = (startTime) => [1, startTime];
 
             // Test the time parameter
-            doTests(should, gain, 'TypeError', nonFiniteValues, [
+            doTests(should, gain, TypeError, nonFiniteValues, [
               {automationName: 'setValueAtTime', funcArg: defaultFuncArg},
               {
                 automationName: 'linearRampToValueAtTime',
                 funcArg: defaultFuncArg
               },
               {
                 automationName: 'exponentialRampToValueAtTime',
                 funcArg: defaultFuncArg
@@ -107,26 +107,26 @@
           },
           (task, should) => {
             let gain = context.createGain();
 
             // Just an array for use by setValueCurveAtTime. The length and
             // contents of the array are not important.
             let curve = new Float32Array(3);
 
-            doTests(should, gain, 'TypeError', nonFiniteValues, [
+            doTests(should, gain, TypeError, nonFiniteValues, [
               {
                 automationName: 'setValueCurveAtTime',
                 funcArg: (startTime) => [curve, startTime, 1]
               },
             ]);
 
             // Non-finite values for the curve should signal an error
             doTests(
-                should, gain, 'TypeError',
+                should, gain, TypeError,
                 [[1, 2, Infinity, 3], [1, NaN, 2, 3]], [{
                   automationName: 'setValueCurveAtTime',
                   funcArg: (c) => [c, 1, 1]
                 }]);
 
             task.done();
           });
 
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html
@@ -111,17 +111,17 @@
                  'testNode.channelCountMode (set via options.' + mode + ')')
               .beEqualTo(options.channelCountMode);
         });
 
         const options1 = {channelCountMode: 'foobar'};
         should(
             () => new AudioWorkletNode(context, 'dummy', options1),
             'Creating AudioWorkletNode with channelCountMode "foobar"')
-            .throw('TypeError');
+            .throw(TypeError);
 
         task.done();
       });
 
       // Test AudioWorkletNode.channelInterpretation.
       audit.define('channel-interpretation', (task, should) => {
         const channelInterpretations = ['speakers', 'discrete'];
         channelInterpretations.forEach((interpretation) => {
@@ -133,17 +133,17 @@
                   interpretation + ')')
               .beEqualTo(options.channelInterpretation);
         });
 
         const options1 = {channelInterpretation: 'foobar'};
         should(
             () => new AudioWorkletNode(context, 'dummy', options1),
             'Creating AudioWorkletNode with channelCountMode "foobar"')
-            .throw('TypeError');
+            .throw(TypeError);
 
         task.done();
       });
 
       audit.run();
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html
@@ -68,41 +68,41 @@
               // frequencyHz can't be null.
               f.getFrequencyResponse(
                   null, new Float32Array(1), new Float32Array(1));
             },
             'getFrequencyResponse(' +
                 'null, ' +
                 'new Float32Array(1), ' +
                 'new Float32Array(1))')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // magResponse can't be null.
               f.getFrequencyResponse(
                   new Float32Array(1), null, new Float32Array(1));
             },
             'getFrequencyResponse(' +
                 'new Float32Array(1), ' +
                 'null, ' +
                 'new Float32Array(1))')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // phaseResponse can't be null.
               f.getFrequencyResponse(
                   new Float32Array(1), new Float32Array(1), null);
             },
             'getFrequencyResponse(' +
                 'new Float32Array(1), ' +
                 'new Float32Array(1), ' +
                 'null)')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // magResponse array must the same length as frequencyHz
               f.getFrequencyResponse(
                   new Float32Array(10), new Float32Array(1),
                   new Float32Array(20));
             },
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
@@ -94,31 +94,31 @@
           {
             testAttribute: 'channelCountMode',
             testValue: 'max',
             expectedErrorType: 'NotSupportedError'
           },
           {
             testAttribute: 'channelCountMode',
             testValue: 'foobar',
-            expectedErrorType: 'TypeError'
+            expectedErrorType: TypeError
           },
           // Test channel interpretation
           {
             testAttribute: 'channelInterpretation',
             testValue: 'speakers',
           },
           {
             testAttribute: 'channelInterpretation',
             testValue: 'discrete',
           },
           {
             testAttribute: 'channelInterpretation',
             testValue: 'foobar',
-            expectedErrorType: 'TypeError'
+            expectedErrorType: TypeError
           }
         ];
 
         testOptions.forEach((option) => {
           let nodeOptions = {};
           nodeOptions[option.testAttribute] = option.testValue;
 
           testNode(should, context, {
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter.html
@@ -52,25 +52,25 @@
         let node;
 
         let options = {feedback: [1, .5]};
         should(
             () => {
               node = new IIRFilterNode(context, options);
             },
             'node = new IIRFilterNode(, ' + JSON.stringify(options) + ')')
-            .throw('TypeError');
+            .throw(TypeError);
 
         options = {feedforward: [1, 0.5]};
         should(
             () => {
               node = new IIRFilterNode(context, options);
             },
             'node = new IIRFilterNode(c, ' + JSON.stringify(options) + ')')
-            .throw('TypeError');
+            .throw(TypeError);
 
         task.done();
       });
 
       // Test functionality of constructor.  This is needed because we have no
       // way of determining if the filter coefficients were were actually set
       // appropriately.
 
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-basic.html
@@ -46,27 +46,27 @@
 
         task.done();
       });
 
       audit.define('exceptions-createIIRFilter', (task, should) => {
         should(function() {
           // Two args are required.
           context.createIIRFilter();
-        }, 'createIIRFilter()').throw('TypeError');
+        }, 'createIIRFilter()').throw(TypeError);
 
         should(function() {
           // Two args are required.
           context.createIIRFilter(new Float32Array(1));
-        }, 'createIIRFilter(new Float32Array(1))').throw('TypeError');
+        }, 'createIIRFilter(new Float32Array(1))').throw(TypeError);
 
         should(function() {
           // null is not valid
           context.createIIRFilter(null, null);
-        }, 'createIIRFilter(null, null)').throw('TypeError');
+        }, 'createIIRFilter(null, null)').throw(TypeError);
 
         should(function() {
           // There has to be at least one coefficient.
           context.createIIRFilter([], []);
         }, 'createIIRFilter([], [])').throw('NotSupportedError');
 
         should(function() {
           // There has to be at least one coefficient.
@@ -122,27 +122,27 @@
               context.createIIRFilter(new Float32Array(10), [1]);
             },
             'createIIRFilter(new Float32Array(10), [1])')
             .throw('InvalidStateError');
 
         should(function() {
           // Feedback coefficients must be finite.
           context.createIIRFilter([1], [1, Infinity, NaN]);
-        }, 'createIIRFilter([1], [1, NaN, Infinity])').throw('TypeError');
+        }, 'createIIRFilter([1], [1, NaN, Infinity])').throw(TypeError);
 
         should(function() {
           // Feedforward coefficients must be finite.
           context.createIIRFilter([1, Infinity, NaN], [1]);
-        }, 'createIIRFilter([1, NaN, Infinity], [1])').throw('TypeError');
+        }, 'createIIRFilter([1, NaN, Infinity], [1])').throw(TypeError);
 
         should(function() {
           // Test that random junk in the array is converted to NaN.
           context.createIIRFilter([1, 'abc', []], [1]);
-        }, 'createIIRFilter([1, \'abc\', []], [1])').throw('TypeError');
+        }, 'createIIRFilter([1, \'abc\', []], [1])').throw(TypeError);
 
         task.done();
       });
 
       audit.define('exceptions-getFrequencyData', (task, should) => {
         // Create a really simple IIR filter. Doesn't much matter what.
         let coef = Float32Array.from([1]);
 
@@ -150,35 +150,35 @@
 
         should(
             function() {
               // frequencyHz can't be null.
               f.getFrequencyResponse(
                   null, new Float32Array(1), new Float32Array(1));
             },
             'getFrequencyResponse(null, new Float32Array(1), new Float32Array(1))')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // magResponse can't be null.
               f.getFrequencyResponse(
                   new Float32Array(1), null, new Float32Array(1));
             },
             'getFrequencyResponse(new Float32Array(1), null, new Float32Array(1))')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // phaseResponse can't be null.
               f.getFrequencyResponse(
                   new Float32Array(1), new Float32Array(1), null);
             },
             'getFrequencyResponse(new Float32Array(1), new Float32Array(1), null)')
-            .throw('TypeError');
+            .throw(TypeError);
 
         should(
             function() {
               // magResponse array must the same length as frequencyHz
               f.getFrequencyResponse(
                   new Float32Array(10), new Float32Array(1),
                   new Float32Array(20));
             },
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-offlineaudiocontext-interface/ctor-offlineaudiocontext.html
@@ -18,22 +18,22 @@
       audit.define(
           {label: 'basic', description: 'Old-style constructor'},
           (task, should) => {
             let context;
 
             // First and only arg should be a dictionary.
             should(() => {
               new OfflineAudioContext(3);
-            }, 'new OfflineAudioContext(3)').throw('TypeError');
+            }, 'new OfflineAudioContext(3)').throw(TypeError);
 
             // Constructor needs 1 or 3 args, so 2 should throw.
             should(() => {
               new OfflineAudioContext(3, 42);
-            }, 'new OfflineAudioContext(3, 42)').throw('TypeError');
+            }, 'new OfflineAudioContext(3, 42)').throw(TypeError);
 
             // Valid constructor
             should(() => {
               context = new OfflineAudioContext(3, 42, 12345);
             }, 'context = new OfflineAudioContext(3, 42, 12345)').notThrow();
 
             // Verify that the context was constructed correctly.
             should(context.length, 'context.length').beEqualTo(42);
@@ -58,40 +58,40 @@
       audit.define(
           {label: 'options-1', description: 'Required options'},
           (task, should) => {
             let context2;
 
             // No args should throw
             should(() => {
               new OfflineAudioContext();
-            }, 'new OfflineAudioContext()').throw('TypeError');
+            }, 'new OfflineAudioContext()').throw(TypeError);
 
             // Empty OfflineAudioContextOptions should throw
             should(() => {
               new OfflineAudioContext({});
-            }, 'new OfflineAudioContext({})').throw('TypeError');
+            }, 'new OfflineAudioContext({})').throw(TypeError);
 
             let options = {length: 42};
             // sampleRate is required.
             should(
                 () => {
                   new OfflineAudioContext(options);
                 },
                 'new OfflineAudioContext(' + JSON.stringify(options) + ')')
-                .throw('TypeError');
+                .throw(TypeError);
 
             options = {sampleRate: 12345};
             // length is required.
             should(
                 () => {
                   new OfflineAudioContext(options);
                 },
                 'new OfflineAudioContext(' + JSON.stringify(options) + ')')
-                .throw('TypeError');
+                .throw(TypeError);
 
             // Valid constructor.  Verify that the resulting context has the
             // correct values.
             options = {length: 42, sampleRate: 12345};
             should(
                 () => {
                   context2 = new OfflineAudioContext(options);
                 },
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html
@@ -156,17 +156,17 @@
             .throw('NotSupportedError');
 
         options = {channelCountMode: 'foobar'};
         should(
             () => {
               node = new PannerNode(context, options);
             },
             'new PannerNode(c, " + JSON.stringify(options) + ")')
-            .throw('TypeError');
+            .throw(TypeError);
 
         // Test channelInterpretation.
         options = {channelInterpretation: 'speakers'};
         should(
             () => {
               node = new PannerNode(context, options);
             },
             'node5 = new PannerNode(c, ' + JSON.stringify(options) + ')')
@@ -185,17 +185,17 @@
             .beEqualTo(options.channelInterpretation);
 
         options = {channelInterpretation: 'foobar'};
         should(
             () => {
               node = new PannerNode(context, options);
             },
             'new PannerNode(c, ' + JSON.stringify(options) + ')')
-            .throw('TypeError');
+            .throw(TypeError);
 
         task.done();
       });
 
       audit.define('constructor with options', (task, should) => {
         let node;
         let success = true;
         let options = {
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-stereopanner-interface/ctor-stereopanner.html
@@ -60,26 +60,26 @@
         },
          {
            // Test channelCountMode.  A mode of "max" is illegal, but others are
            // ok.  But also throw an error of unknown values.
            attribute: 'channelCountMode',
            tests: [
              {value: 'clamped-max'}, {value: 'explicit'},
              {value: 'max', error: 'NotSupportedError'},
-             {value: 'foobar', error: 'TypeError'}
+             {value: 'foobar', error: TypeError}
            ]
          },
          {
            // Test channelInterpretation can be set for valid values and an
            // error is thrown for others.
            attribute: 'channelInterpretation',
            tests: [
              {value: 'speakers'}, {value: 'discrete'},
-             {value: 'foobar', error: 'TypeError'}
+             {value: 'foobar', error: TypeError}
            ]
          }].forEach(entry => {
           entry.tests.forEach(testItem => {
             let options = {};
             options[entry.attribute] = testItem.value;
             let method = testItem.error ? 'throw' : 'notThrow';
 
             should(