зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1456946 - Don't call AudioNode::Initialize on an ChannelSplitterNode during construction to avoid throwing. r=achronop
We initialize the channelCountMode and channelInterpretation (that cannot be changed) appropriately in the C++ ctor, and the channelCount manually as well. Then we check manually that the options for the channelCountMode, the channelCount and channelInterpretation have not been passed, or are not incorrect. MozReview-Commit-ID: 4YdYfaGqKqn --HG-- extra : rebase_source : 1133e35b74249f5457d1584601e8d4c64cb154cc
This commit is contained in:
Родитель
80a1f3c079
Коммит
a97337d7fc
|
@ -82,8 +82,22 @@ ChannelSplitterNode::Create(AudioContext& aAudioContext,
|
|||
RefPtr<ChannelSplitterNode> audioNode =
|
||||
new ChannelSplitterNode(&aAudioContext, aOptions.mNumberOfOutputs);
|
||||
|
||||
audioNode->Initialize(aOptions, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
// Manually check that the other options are valid, this node has channelCount,
|
||||
// channelCountMode and channelInterpretation constraints: they cannot be
|
||||
// changed from the default.
|
||||
if (aOptions.mChannelCount.WasPassed() &&
|
||||
aOptions.mChannelCount.Value() != audioNode->ChannelCount()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (aOptions.mChannelInterpretation.WasPassed() &&
|
||||
aOptions.mChannelInterpretation.Value() != audioNode->ChannelInterpretationValue()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (aOptions.mChannelCountMode.WasPassed() &&
|
||||
aOptions.mChannelCountMode.Value() != audioNode->ChannelCountModeValue()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче