Index: Source/modules/webaudio/OfflineAudioContext.cpp |
diff --git a/Source/modules/webaudio/OfflineAudioContext.cpp b/Source/modules/webaudio/OfflineAudioContext.cpp |
index adfe8ce72288dd06ca08f25b8b6bf35b3e839813..7cc900a6a101c7e03700ad0d0fb4c528816e2d93 100644 |
--- a/Source/modules/webaudio/OfflineAudioContext.cpp |
+++ b/Source/modules/webaudio/OfflineAudioContext.cpp |
@@ -28,6 +28,7 @@ |
#include "modules/webaudio/OfflineAudioContext.h" |
+#include "bindings/v8/ExceptionMessages.h" |
#include "bindings/v8/ExceptionState.h" |
#include "core/dom/Document.h" |
#include "core/dom/ExceptionCode.h" |
@@ -39,14 +40,29 @@ PassRefPtr<OfflineAudioContext> OfflineAudioContext::create(ScriptExecutionConte |
{ |
// FIXME: add support for workers. |
if (!context || !context->isDocument()) { |
- es.throwUninformativeAndGenericDOMException(NotSupportedError); |
+ es.throwDOMException( |
+ NotSupportedError, |
+ ExceptionMessages::failedToConstruct("OfflineAudioContext")); |
return 0; |
} |
Document* document = toDocument(context); |
- if (numberOfChannels > 10 || !isSampleRateRangeGood(sampleRate)) { |
- es.throwUninformativeAndGenericDOMException(SyntaxError); |
+ if (numberOfChannels > 10) { |
+ es.throwDOMException( |
+ SyntaxError, |
+ ExceptionMessages::failedToConstruct( |
+ "OfflineAudioContext", |
+ "number of channels (" + String::number(numberOfChannels) + ") exceeds maximum (10).")); |
+ return 0; |
+ } |
+ |
+ if (!isSampleRateRangeGood(sampleRate)) { |
+ es.throwDOMException( |
+ SyntaxError, |
+ ExceptionMessages::failedToConstruct( |
+ "OfflineAudioContext", |
+ "sample rate (" + String::number(sampleRate) + ") must be in the range 44100-96000 Hz.")); |
return 0; |
} |