- Revision
- 196130
- Author
- [email protected]
- Date
- 2016-02-04 10:03:34 -0800 (Thu, 04 Feb 2016)
Log Message
Specify an exception for createChannelMerger, createChannelSplitter and createPeriodicWave
https://bugs.webkit.org/show_bug.cgi?id=150925
Patch by Hyemi Shin <[email protected]> on 2016-02-04
Reviewed by Darin Adler.
createChannelMerger and createChannelSplitter should throw INDEX_SIZE_ERR
for invalid numberOfInputs value.
createPeriodicWave should throw INDEX_SIZE_ERR for invalid lengths of parameters.
Source/WebCore:
Tests: webaudio/audiochannelmerger-basic.html
webaudio/audiochannelsplitter.html
webaudio/periodicwave-lengths.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createChannelSplitter):
(WebCore::AudioContext::createChannelMerger):
(WebCore::AudioContext::createPeriodicWave):
LayoutTests:
* webaudio/audiochannelmerger-basic-expected.txt: numberOfInputs could be 32.
* webaudio/audiochannelmerger-basic.html: Ditto.
* webaudio/audiochannelsplitter-expected.txt: Ditto.
* webaudio/audiochannelsplitter.html: Ditto.
* webaudio/periodicwave-lengths-expected.txt: Added.
* webaudio/periodicwave-lengths.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (196129 => 196130)
--- trunk/LayoutTests/ChangeLog 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/LayoutTests/ChangeLog 2016-02-04 18:03:34 UTC (rev 196130)
@@ -1,3 +1,21 @@
+2016-02-04 Hyemi Shin <[email protected]>
+
+ Specify an exception for createChannelMerger, createChannelSplitter and createPeriodicWave
+ https://bugs.webkit.org/show_bug.cgi?id=150925
+
+ Reviewed by Darin Adler.
+
+ createChannelMerger and createChannelSplitter should throw INDEX_SIZE_ERR
+ for invalid numberOfInputs value.
+ createPeriodicWave should throw INDEX_SIZE_ERR for invalid lengths of parameters.
+
+ * webaudio/audiochannelmerger-basic-expected.txt: numberOfInputs could be 32.
+ * webaudio/audiochannelmerger-basic.html: Ditto.
+ * webaudio/audiochannelsplitter-expected.txt: Ditto.
+ * webaudio/audiochannelsplitter.html: Ditto.
+ * webaudio/periodicwave-lengths-expected.txt: Added.
+ * webaudio/periodicwave-lengths.html: Added.
+
2016-02-04 Ryan Haddad <[email protected]>
Rebaseline imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/select-ask-for-reset.html for ios-simulator
Modified: trunk/LayoutTests/webaudio/audiochannelmerger-basic-expected.txt (196129 => 196130)
--- trunk/LayoutTests/webaudio/audiochannelmerger-basic-expected.txt 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/LayoutTests/webaudio/audiochannelmerger-basic-expected.txt 2016-02-04 18:03:34 UTC (rev 196130)
@@ -2,8 +2,8 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS Exception was thrown for numberOfInputs <= 0.
-PASS Exception was thrown for numberOfInputs >= 32.
+PASS IndexSizeError was thrown for numberOfInputs <= 0.
+PASS IndexSizeError was thrown for numberOfInputs > 32.
PASS AudioChannelMerger created successfully with numberOfInputs = 32.
PASS AudioChannelMerger created successfully with empty parameter.
PASS ChannelMergerNode Object is available.
Modified: trunk/LayoutTests/webaudio/audiochannelmerger-basic.html (196129 => 196130)
--- trunk/LayoutTests/webaudio/audiochannelmerger-basic.html 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/LayoutTests/webaudio/audiochannelmerger-basic.html 2016-02-04 18:03:34 UTC (rev 196130)
@@ -26,16 +26,22 @@
try {
var mergernode = context.createChannelMerger(0);
- testFailed("Exception should be thrown for numberOfInputs <= 0.");
+ testFailed("IndexSizeError should be thrown for numberOfInputs <= 0.");
} catch(e) {
- testPassed("Exception was thrown for numberOfInputs <= 0.");
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError was thrown for numberOfInputs <= 0.");
+ else
+ testFailed("IndexSizeError should be thrown for numberOfInputs <= 0.");
}
try {
var mergernode = context.createChannelMerger(33);
- testFailed("Exception should be thrown for numberOfInputs >= 32.");
+ testFailed("IndexSizeError should be thrown for numberOfInputs > 32.");
} catch(e) {
- testPassed("Exception was thrown for numberOfInputs >= 32.");
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError was thrown for numberOfInputs > 32.");
+ else
+ testFailed("IndexSizeError should be thrown for numberOfInputs > 32.");
}
try {
Modified: trunk/LayoutTests/webaudio/audiochannelsplitter-expected.txt (196129 => 196130)
--- trunk/LayoutTests/webaudio/audiochannelsplitter-expected.txt 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/LayoutTests/webaudio/audiochannelsplitter-expected.txt 2016-02-04 18:03:34 UTC (rev 196130)
@@ -2,8 +2,8 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS Exception been thrown for numberOfOutputs <= 0.
-PASS Exception been thrown for numberOfOutputs >= 32.
+PASS IndexSizeError been thrown for numberOfOutputs <= 0.
+PASS IndexSizeError been thrown for numberOfOutputs > 32.
PASS AudioChannelSplitter created successfully with numberOfOutputs = 32.
PASS AudioChannelSplitter has 32 outputs when it is created with numberOfOutputs = 32.
PASS AudioChannelSplitter has one input.
Modified: trunk/LayoutTests/webaudio/audiochannelsplitter.html (196129 => 196130)
--- trunk/LayoutTests/webaudio/audiochannelsplitter.html 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/LayoutTests/webaudio/audiochannelsplitter.html 2016-02-04 18:03:34 UTC (rev 196130)
@@ -85,16 +85,22 @@
try {
var splitternode = context.createChannelSplitter(0);
- testFailed("Exception should be thrown for numberOfOutputs <= 0.");
+ testFailed("IndexSizeError should be thrown for numberOfOutputs <= 0.");
} catch(e) {
- testPassed("Exception been thrown for numberOfOutputs <= 0.");
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError been thrown for numberOfOutputs <= 0.");
+ else
+ testFailed("IndexSizeError should be thrown for numberOfOutputs <= 0.");
}
try {
var splitternode = context.createChannelSplitter(33);
- testFailed("Exception should be thrown for numerOfOutputs >= 32.");
+ testFailed("IndexSizeError should be thrown for numerOfOutputs > 32.");
} catch(e) {
- testPassed("Exception been thrown for numberOfOutputs >= 32.");
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError been thrown for numberOfOutputs > 32.");
+ else
+ testFailed("IndexSizeError should be thrown for numerOfOutputs > 32.");
}
try {
Added: trunk/LayoutTests/webaudio/periodicwave-lengths-expected.txt (0 => 196130)
--- trunk/LayoutTests/webaudio/periodicwave-lengths-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/periodicwave-lengths-expected.txt 2016-02-04 18:03:34 UTC (rev 196130)
@@ -0,0 +1,13 @@
+Basic tests for PeriodicWave.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS IndexSizeError was thrown for the length of Float32Array <= 0.
+PASS IndexSizeError was thrown for the length of Float32Array > 4096.
+PASS IndexSizeError was thrown for parameters are not eqaul lengths.
+PASS PeriodicWave created successfully with the length of Float32Array = 4096.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/periodicwave-lengths.html (0 => 196130)
--- trunk/LayoutTests/webaudio/periodicwave-lengths.html (rev 0)
+++ trunk/LayoutTests/webaudio/periodicwave-lengths.html 2016-02-04 18:03:34 UTC (rev 196130)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+
+<body>
+<script>
+description("Basic tests for PeriodicWave.");
+
+var context = new webkitAudioContext();
+
+var zeroWaveCoef = new Float32Array(0);
+var overWaveCoef = new Float32Array(4097);
+var minWaveCoef = new Float32Array(1);
+var maxWaveCoef = new Float32Array(4096);
+
+try {
+ var zeroPeriodicWave = context.createPeriodicWave(zeroWaveCoef, zeroWaveCoef);
+ testFailed("IndexSizeError should be thrown for the length of Float32Array <= 0.");
+} catch(e) {
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError was thrown for the length of Float32Array <= 0.");
+ else
+ testFailed("IndexSizeError should be thrown for the length of Float32Array <= 0.");
+}
+
+try {
+ var overPeriodicWave = context.createPeriodicWave(overWaveCoef, overWaveCoef);
+ testFailed("IndexSizeError should be thrown for the length of Float32Array > 4096.");
+} catch(e) {
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError was thrown for the length of Float32Array > 4096.");
+ else
+ testFailed("IndexSizeError should be thrown for the length of Float32Array > 4096.");
+}
+
+try {
+ var diffPeriodicWave = context.createPeriodicWave(minWaveCoef, maxWaveCoef);
+ testFailed("IndexSizeError should be thrown for parameters are not eqaul lengths.");
+} catch(e) {
+ if (e.code === DOMException.INDEX_SIZE_ERR)
+ testPassed("IndexSizeError was thrown for parameters are not eqaul lengths.");
+ else
+ testFailed("IndexSizeError should be thrown for parameters are not eqaul lengths.");
+}
+
+try {
+ var maxPeriodicWave = context.createPeriodicWave(maxWaveCoef, maxWaveCoef);
+ testPassed("PeriodicWave created successfully with the length of Float32Array = 4096.");
+} catch(e) {
+ testFailed("Failed to create PeriodicWave with the length of Float32Array = 4096.");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (196129 => 196130)
--- trunk/Source/WebCore/ChangeLog 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/Source/WebCore/ChangeLog 2016-02-04 18:03:34 UTC (rev 196130)
@@ -1,3 +1,23 @@
+2016-02-04 Hyemi Shin <[email protected]>
+
+ Specify an exception for createChannelMerger, createChannelSplitter and createPeriodicWave
+ https://bugs.webkit.org/show_bug.cgi?id=150925
+
+ Reviewed by Darin Adler.
+
+ createChannelMerger and createChannelSplitter should throw INDEX_SIZE_ERR
+ for invalid numberOfInputs value.
+ createPeriodicWave should throw INDEX_SIZE_ERR for invalid lengths of parameters.
+
+ Tests: webaudio/audiochannelmerger-basic.html
+ webaudio/audiochannelsplitter.html
+ webaudio/periodicwave-lengths.html
+
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::createChannelSplitter):
+ (WebCore::AudioContext::createChannelMerger):
+ (WebCore::AudioContext::createPeriodicWave):
+
2016-02-04 Youenn Fablet <[email protected]>
[Fetch API] Add support for iterating over Headers
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (196129 => 196130)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2016-02-04 17:45:44 UTC (rev 196129)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2016-02-04 18:03:34 UTC (rev 196130)
@@ -608,7 +608,7 @@
RefPtr<ChannelSplitterNode> node = ChannelSplitterNode::create(this, m_destinationNode->sampleRate(), numberOfOutputs);
if (!node.get()) {
- ec = SYNTAX_ERR;
+ ec = INDEX_SIZE_ERR;
return nullptr;
}
@@ -629,7 +629,7 @@
RefPtr<ChannelMergerNode> node = ChannelMergerNode::create(this, m_destinationNode->sampleRate(), numberOfInputs);
if (!node.get()) {
- ec = SYNTAX_ERR;
+ ec = INDEX_SIZE_ERR;
return nullptr;
}
@@ -655,7 +655,7 @@
ASSERT(isMainThread());
if (!real || !imag || (real->length() != imag->length() || (real->length() > MaxPeriodicWaveLength) || (real->length() <= 0))) {
- ec = SYNTAX_ERR;
+ ec = INDEX_SIZE_ERR;
return nullptr;
}