Bug 1619607 - When attempting to create an AudioWorkletNode with non-existing processor, throw InvalidStateError. r=karlt

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Adenot 2020-03-11 14:45:12 +00:00
Родитель 1b0965006c
Коммит ae95e91636
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -582,14 +582,14 @@ already_AddRefed<AudioWorkletNode> AudioWorkletNode::Constructor(
ErrorResult& aRv) {
/**
* 1. If nodeName does not exist as a key in the BaseAudioContexts node
* name to parameter descriptor map, throw a NotSupportedError exception
* name to parameter descriptor map, throw a InvalidStateError exception
* and abort these steps.
*/
const AudioParamDescriptorMap* parameterDescriptors =
aAudioContext.GetParamMapForWorkletName(aName);
if (!parameterDescriptors) {
// Not using nsPrintfCString in case aName has embedded nulls.
aRv.ThrowNotSupportedError(
aRv.ThrowInvalidStateError(
NS_LITERAL_CSTRING("Unknown AudioWorklet name '") +
NS_ConvertUTF16toUTF8(aName) + NS_LITERAL_CSTRING("'"));
return nullptr;