Bug 1558526 remove check for callable process() in registerProcessor() r=bzbarsky

Since https://github.com/WebAudio/web-audio-api/pull/2104

Differential Revision: https://phabricator.services.mozilla.com/D55227

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karl Tomlinson 2020-01-10 02:31:13 +00:00
parent 1f2ca5b410
commit e026e88f35
3 changed files with 9 additions and 37 deletions

View File

@ -119,27 +119,8 @@ void AudioWorkletGlobalScope::RegisterProcessor(
"processorCtor.prototype"));
return;
}
/**
* 6. If the result of IsCallable(argument=Get(O=prototype, P="process"))
* is false, throw a TypeError and abort these steps.
*/
JS::Rooted<JS::Value> process(aCx);
JS::Rooted<JSObject*> prototypeObject(aCx, &prototype.toObject());
if (!JS_GetProperty(aCx, prototypeObject, "process", &process)) {
aRv.NoteJSContextException(aCx);
return;
}
if (!process.isObjectOrNull() || !JS::IsCallable(process.toObjectOrNull())) {
aRv.ThrowTypeError<MSG_NOT_CALLABLE>(NS_LITERAL_STRING(
"Argument 2 of AudioWorkletGlobalScope.registerProcessor "
"constructor.process"));
return;
}
/**
* 7. Let descriptors be the result of Get(O=processorCtor,
* 6. Let parameterDescriptorsValue be the result of Get(O=processorCtor,
* P="parameterDescriptors").
*/
JS::Rooted<JS::Value> descriptors(aCx);
@ -148,8 +129,12 @@ void AudioWorkletGlobalScope::RegisterProcessor(
aRv.NoteJSContextException(aCx);
return;
}
/**
/** TODO https://bugzilla.mozilla.org/show_bug.cgi?id=1565464
* 7. Let parameterDescriptorSequence be the result of the conversion
* from parameterDescriptorsValue to an IDL value of type
* sequence<AudioParamDescriptor>.
*
* This is now obsolete:
* 8. If descriptors is neither an array nor undefined, throw a
* TypeError and abort these steps.
*/

View File

@ -16,8 +16,6 @@ function configureTest() {
"TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor is not a constructor.",
"NotSupportedError: Argument 1 of AudioWorkletGlobalScope.registerProcessor should not be an empty string.",
"TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor is not an object.",
"TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.process is not callable.",
"TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.process is not callable.",
"TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.parameterDescriptors is neither an array nor undefined.",
"NotSupportedError: Argument 1 of AudioWorkletGlobalScope.registerProcessor is invalid: a class with the same name is already registered.",
"TypeError: Missing required 'name' member of AudioParamDescriptor.",

View File

@ -1,5 +1,4 @@
// Define several classes.
// Only the last ones are valid.
class EmptyWorkletProcessor extends AudioWorkletProcessor {}
class NoProcessWorkletProcessor extends AudioWorkletProcessor {
@ -249,20 +248,10 @@ try {
}
// Test Empty class definition
// "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.process is not callable."
try {
registerProcessor("empty-worklet-processor", EmptyWorkletProcessor);
} catch (e) {
console.log(e);
}
registerProcessor("empty-worklet-processor", EmptyWorkletProcessor);
// Test class with constructor but not process function
// "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.process is not callable."
try {
registerProcessor("no-worklet-processor", NoProcessWorkletProcessor);
} catch (e) {
console.log(e);
}
registerProcessor("no-worklet-processor", NoProcessWorkletProcessor);
// Test class with parameterDescriptors not being array nor undefined
// "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.parameterDescriptors is neither an array nor undefined."