Diff
Modified: trunk/LayoutTests/ChangeLog (111820 => 111821)
--- trunk/LayoutTests/ChangeLog 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/LayoutTests/ChangeLog 2012-03-23 03:49:33 UTC (rev 111821)
@@ -1,3 +1,13 @@
+2012-03-22 Xingnan Wang <[email protected]>
+
+ Add exception for the setter of "fftSize" in RealtimeAnalyserNode
+ https://bugs.webkit.org/show_bug.cgi?id=81748
+
+ Reviewed by Chris Rogers.
+
+ * webaudio/realtimeanalyser-fft-sizing-expected.txt:
+ * webaudio/realtimeanalyser-fft-sizing.html:
+
2012-03-22 Emil A Eklund <[email protected]>
Unreviewed rebaseline of chrome-win table tests post r111742.
Modified: trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing-expected.txt (111820 => 111821)
--- trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing-expected.txt 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing-expected.txt 2012-03-23 03:49:33 UTC (rev 111821)
@@ -2,6 +2,43 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS Exception thrown for illegal fftSize -1.
+PASS Exception thrown for illegal fftSize 0.
+PASS Exception thrown for illegal fftSize 1.
+PASS Exception thrown for illegal fftSize 2.
+PASS Exception thrown for illegal fftSize 3.
+PASS Exception thrown for illegal fftSize 4.
+PASS Exception thrown for illegal fftSize 5.
+PASS Exception thrown for illegal fftSize 8.
+PASS Exception thrown for illegal fftSize 9.
+PASS Exception thrown for illegal fftSize 16.
+PASS Exception thrown for illegal fftSize 17.
+PASS Exception thrown for illegal fftSize 32.
+PASS Exception thrown for illegal fftSize 33.
+PASS Exception thrown for illegal fftSize 64.
+PASS Exception thrown for illegal fftSize 65.
+PASS Successfully set legal fftSize 128.
+PASS Exception thrown for illegal fftSize 129.
+PASS Successfully set legal fftSize 256.
+PASS Exception thrown for illegal fftSize 257.
+PASS Successfully set legal fftSize 512.
+PASS Exception thrown for illegal fftSize 513.
+PASS Successfully set legal fftSize 1024.
+PASS Exception thrown for illegal fftSize 1025.
+PASS Successfully set legal fftSize 2048.
+PASS Exception thrown for illegal fftSize 2049.
+PASS Exception thrown for illegal fftSize 4096.
+PASS Exception thrown for illegal fftSize 4097.
+PASS Exception thrown for illegal fftSize 8192.
+PASS Exception thrown for illegal fftSize 8193.
+PASS Exception thrown for illegal fftSize 16384.
+PASS Exception thrown for illegal fftSize 16385.
+PASS Exception thrown for illegal fftSize 32768.
+PASS Exception thrown for illegal fftSize 32769.
+PASS Exception thrown for illegal fftSize 65536.
+PASS Exception thrown for illegal fftSize 65537.
+PASS Exception thrown for illegal fftSize 131072.
+PASS Exception thrown for illegal fftSize 131073.
PASS webkitAudioContext survived multiple invalid FFT array resizings.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing.html (111820 => 111821)
--- trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing.html 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/LayoutTests/webaudio/realtimeanalyser-fft-sizing.html 2012-03-23 03:49:33 UTC (rev 111821)
@@ -18,21 +18,32 @@
layoutTestController.waitUntilDone();
}
-var doTest = function(fftSize) {
+var doTest = function(fftSize, illegal) {
var c = new webkitAudioContext(1, 1000, 44100);
var a = c.createAnalyser();
- a.fftSize = fftSize;
+ try {
+ a.fftSize = fftSize;
+ if (illegal)
+ testFailed("No exception thrown for illegal fftSize " + fftSize + ".");
+ else
+ testPassed("Successfully set legal fftSize " + fftSize + ".");
+ } catch(e) {
+ testPassed("Exception thrown for illegal fftSize " + fftSize + ".");
+ }
// This arbitrary size does not affect the correctness of the test.
var arr = new Float32Array(100);
a.getFloatFrequencyData(arr);
}
-doTest(-1);
-doTest(0);
-doTest(1);
+doTest(-1, true);
+doTest(0, true);
+doTest(1, true);
for (var i = 2; i <= 0x20000; i *= 2) {
- doTest(i);
- doTest(i + 1);
+ if (i >= 128 && i <= 2048)
+ doTest(i, false);
+ else
+ doTest(i, true);
+ doTest(i + 1, true);
}
if (window.layoutTestController)
Modified: trunk/Source/WebCore/ChangeLog (111820 => 111821)
--- trunk/Source/WebCore/ChangeLog 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/ChangeLog 2012-03-23 03:49:33 UTC (rev 111821)
@@ -1,3 +1,21 @@
+2012-03-22 Xingnan Wang <[email protected]>
+
+ Add exception for the setter of "fftSize" in RealtimeAnalyserNode
+ https://bugs.webkit.org/show_bug.cgi?id=81748
+
+ Reviewed by Chris Rogers.
+
+ * Modules/webaudio/RealtimeAnalyser.cpp:
+ (WebCore::RealtimeAnalyser::setFftSize):
+ * Modules/webaudio/RealtimeAnalyser.h:
+ (RealtimeAnalyser):
+ * Modules/webaudio/RealtimeAnalyserNode.cpp:
+ (WebCore::RealtimeAnalyserNode::setFftSize):
+ (WebCore):
+ * Modules/webaudio/RealtimeAnalyserNode.h:
+ (RealtimeAnalyserNode):
+ * Modules/webaudio/RealtimeAnalyserNode.idl:
+
2012-03-22 Leo Yang <[email protected]>
[BlackBerry] Add HistoryItemViewState for BlackBerry port
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp (111820 => 111821)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp 2012-03-23 03:49:33 UTC (rev 111821)
@@ -78,7 +78,7 @@
m_magnitudeBuffer.zero();
}
-void RealtimeAnalyser::setFftSize(size_t size)
+bool RealtimeAnalyser::setFftSize(size_t size)
{
ASSERT(isMainThread());
@@ -86,10 +86,8 @@
unsigned log2size = static_cast<unsigned>(log2(size));
bool isPOT(1UL << log2size == size);
- if (!isPOT || size > MaxFFTSize || size < MinFFTSize) {
- // FIXME: It would be good to also set an exception.
- return;
- }
+ if (!isPOT || size > MaxFFTSize || size < MinFFTSize)
+ return false;
if (m_fftSize != size) {
m_analysisFrame = adoptPtr(new FFTFrame(size));
@@ -97,6 +95,8 @@
m_magnitudeBuffer.allocate(size / 2);
m_fftSize = size;
}
+
+ return true;
}
void RealtimeAnalyser::writeInput(AudioBus* bus, size_t framesToProcess)
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h (111820 => 111821)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h 2012-03-23 03:49:33 UTC (rev 111821)
@@ -44,7 +44,7 @@
void reset();
size_t fftSize() const { return m_fftSize; }
- void setFftSize(size_t size);
+ bool setFftSize(size_t);
unsigned frequencyBinCount() const { return m_fftSize / 2; }
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.cpp (111820 => 111821)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.cpp 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.cpp 2012-03-23 03:49:33 UTC (rev 111821)
@@ -30,6 +30,7 @@
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
+#include "ExceptionCode.h"
namespace WebCore {
@@ -83,6 +84,12 @@
m_analyser.reset();
}
+void RealtimeAnalyserNode::setFftSize(unsigned int size, ExceptionCode& ec)
+{
+ if (!m_analyser.setFftSize(size))
+ ec = NOT_SUPPORTED_ERR;
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.h (111820 => 111821)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.h 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.h 2012-03-23 03:49:33 UTC (rev 111821)
@@ -47,7 +47,7 @@
// _javascript_ bindings
unsigned int fftSize() const { return m_analyser.fftSize(); }
- void setFftSize(unsigned int size) { m_analyser.setFftSize(size); }
+ void setFftSize(unsigned int size, ExceptionCode&);
unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount(); }
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.idl (111820 => 111821)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.idl 2012-03-23 03:41:07 UTC (rev 111820)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyserNode.idl 2012-03-23 03:49:33 UTC (rev 111821)
@@ -27,7 +27,8 @@
Conditional=WEB_AUDIO,
JSGenerateToJSObject
] RealtimeAnalyserNode : AudioNode {
- attribute unsigned long fftSize;
+ attribute unsigned long fftSize
+ setter raises(DOMException);
readonly attribute unsigned long frequencyBinCount;
// minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values.