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

Side by Side Diff: Source/modules/webaudio/AnalyserNode.cpp

Issue 24877002: Add more informative messages for DOM exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Upload again Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #if ENABLE(WEB_AUDIO) 27 #if ENABLE(WEB_AUDIO)
28 28
29 #include "modules/webaudio/AnalyserNode.h" 29 #include "modules/webaudio/AnalyserNode.h"
30 30
31 #include "bindings/v8/ExceptionMessages.h"
31 #include "bindings/v8/ExceptionState.h" 32 #include "bindings/v8/ExceptionState.h"
32 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
33 #include "modules/webaudio/AudioNodeInput.h" 34 #include "modules/webaudio/AudioNodeInput.h"
34 #include "modules/webaudio/AudioNodeOutput.h" 35 #include "modules/webaudio/AudioNodeOutput.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 AnalyserNode::AnalyserNode(AudioContext* context, float sampleRate) 39 AnalyserNode::AnalyserNode(AudioContext* context, float sampleRate)
39 : AudioBasicInspectorNode(context, sampleRate, 2) 40 : AudioBasicInspectorNode(context, sampleRate, 2)
40 { 41 {
(...skipping 27 matching lines...) Expand all
68 outputBus->copyFrom(*inputBus); 69 outputBus->copyFrom(*inputBus);
69 } 70 }
70 71
71 void AnalyserNode::reset() 72 void AnalyserNode::reset()
72 { 73 {
73 m_analyser.reset(); 74 m_analyser.reset();
74 } 75 }
75 76
76 void AnalyserNode::setFftSize(unsigned size, ExceptionState& es) 77 void AnalyserNode::setFftSize(unsigned size, ExceptionState& es)
77 { 78 {
78 if (!m_analyser.setFftSize(size)) 79 if (!m_analyser.setFftSize(size)) {
79 es.throwUninformativeAndGenericDOMException(NotSupportedError); 80 es.throwDOMException(
81 NotSupportedError,
82 ExceptionMessages::failedToSet(
83 "fftSize",
84 "AnalyserNode",
85 "FFT size (" + String::number(size)
86 + ") must be a power of two between "
87 + String::number(RealtimeAnalyser::MinFFTSize) + " and "
88 + String::number(RealtimeAnalyser::MaxFFTSize) + ", inclusive")) ;
89 }
80 } 90 }
81 91
82 } // namespace WebCore 92 } // namespace WebCore
83 93
84 #endif // ENABLE(WEB_AUDIO) 94 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698