Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp

Issue 2758783002: Throw correct errors for invalid OfflineAudioContext values (Closed)
Patch Set: Regenerate test result Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
index 37bb3022d4eb77deec92f6c0f3e487bedb692b24..7e4aec0812b8c8d6a637ae450ca68b878326ed1e 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
@@ -59,29 +59,32 @@ OfflineAudioContext* OfflineAudioContext::create(
Document* document = toDocument(context);
if (!numberOfFrames) {
- exceptionState.throwDOMException(SyntaxError,
- "number of frames cannot be zero.");
+ exceptionState.throwDOMException(
+ NotSupportedError,
+ ExceptionMessages::indexExceedsMinimumBound<unsigned>(
+ "number of frames", numberOfFrames, 1));
return nullptr;
}
- if (numberOfChannels > BaseAudioContext::maxNumberOfChannels()) {
+ if (numberOfChannels == 0 ||
+ numberOfChannels > BaseAudioContext::maxNumberOfChannels()) {
exceptionState.throwDOMException(
- IndexSizeError, ExceptionMessages::indexOutsideRange<unsigned>(
- "number of channels", numberOfChannels, 0,
- ExceptionMessages::InclusiveBound,
- BaseAudioContext::maxNumberOfChannels(),
- ExceptionMessages::InclusiveBound));
+ NotSupportedError, ExceptionMessages::indexOutsideRange<unsigned>(
+ "number of channels", numberOfChannels, 1,
+ ExceptionMessages::InclusiveBound,
+ BaseAudioContext::maxNumberOfChannels(),
+ ExceptionMessages::InclusiveBound));
return nullptr;
}
if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate)) {
exceptionState.throwDOMException(
- IndexSizeError, ExceptionMessages::indexOutsideRange(
- "sampleRate", sampleRate,
- AudioUtilities::minAudioBufferSampleRate(),
- ExceptionMessages::InclusiveBound,
- AudioUtilities::maxAudioBufferSampleRate(),
- ExceptionMessages::InclusiveBound));
+ NotSupportedError, ExceptionMessages::indexOutsideRange(
+ "sampleRate", sampleRate,
+ AudioUtilities::minAudioBufferSampleRate(),
+ ExceptionMessages::InclusiveBound,
+ AudioUtilities::maxAudioBufferSampleRate(),
+ ExceptionMessages::InclusiveBound));
return nullptr;
}
@@ -94,6 +97,7 @@ OfflineAudioContext* OfflineAudioContext::create(
String::number(numberOfChannels) + ", " +
String::number(numberOfFrames) + ", " +
String::number(sampleRate) + ")");
+ return nullptr;
}
#if DEBUG_AUDIONODE_REFERENCES
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698