summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhongchan@chromium.org <hongchan@chromium.org>2015-02-02 23:03:02 +0000
committerhongchan@chromium.org <hongchan@chromium.org>2015-02-02 23:03:02 +0000
commitce3ce58ed80068bccb223d17afad65b79f8b27d9 (patch)
tree9665e4260138e9c98f50654ced018f024853453f
parentf983cfce05b254d902a50d82ce39b6bec0544b18 (diff)
downloadchromium_src-ce3ce58ed80068bccb223d17afad65b79f8b27d9.zip
chromium_src-ce3ce58ed80068bccb223d17afad65b79f8b27d9.tar.gz
chromium_src-ce3ce58ed80068bccb223d17afad65b79f8b27d9.tar.bz2
The first argument of AudioNode::connect() method should not be nullable in WebIDL
According to the spec: http://webaudio.github.io/web-audio-api/#idl-def-AudioNode In webaudio/AudioNode.idl, the first argument of AudioNode::connect() should not be nullable. The implementation already throws exception when the argument is set to null. This CL includes fixes on AudioNode.idl and audionode.html layout test. BUG=453643 Review URL: https://codereview.chromium.org/883373004 git-svn-id: svn://svn.chromium.org/blink/trunk@189371 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/LayoutTests/webaudio/audionode-expected.txt9
-rw-r--r--third_party/WebKit/LayoutTests/webaudio/audionode.html35
-rw-r--r--third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt2
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNode.cpp14
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNode.idl4
6 files changed, 15 insertions, 51 deletions
diff --git a/third_party/WebKit/LayoutTests/webaudio/audionode-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audionode-expected.txt
index 41f48c7..ca3a487 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audionode-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audionode-expected.txt
@@ -6,10 +6,11 @@ PASS Source AudioNode has no inputs.
PASS Source AudioNode has one output.
PASS Destination AudioNode has one input.
PASS Destination AudioNode has no outputs.
-PASS connect() exception thrown for illegal destination AudioNode.
-PASS connect() exception thrown for illegal output index.
-PASS connect() exception thrown for illegal input index.
-PASS audioNode.connect(context.destination) succeeded.
+PASS audioNode.connect(0, 0, 0) threw exception TypeError: Failed to execute 'connect' on 'AudioNode': parameter 1 is not of type 'AudioNode'..
+PASS audioNode.connect(null, 0, 0) threw exception TypeError: Failed to execute 'connect' on 'AudioNode': parameter 1 is not of type 'AudioNode'..
+PASS audioNode.connect(context.destination, 5, 0) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (5) exceeds number of outputs (1)..
+PASS audioNode.connect(context.destination, 0, 5) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (5) exceeds number of inputs (1)..
+PASS audioNode.connect(context.destination, 0, 0) did not throw exception.
PASS exception thrown when connecting to other context's node.
PASS context3 = new AudioContext(1, 44100, 44100) did not throw exception.
PASS context3 is not an OfflineAudioContext
diff --git a/third_party/WebKit/LayoutTests/webaudio/audionode.html b/third_party/WebKit/LayoutTests/webaudio/audionode.html
index a91eda5..31686b7 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audionode.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audionode.html
@@ -52,35 +52,12 @@ function runTest() {
testFailed("Destination AudioNode should have no outputs.");
// Try calling connect() method with illegal values.
-
- try {
- audioNode.connect(0, 0, 0);
- testFailed("connect() exception should be thrown for illegal destination AudioNode.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal destination AudioNode.");
- }
-
- try {
- audioNode.connect(context.destination, 5, 0);
- testFailed("connect() exception should be thrown for illegal output index.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal output index.");
- }
-
- try {
- audioNode.connect(context.destination, 0, 5);
- testFailed("connect() exception should be thrown for illegal input index.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal input index.");
- }
-
- // Try calling connect() with proper values.
- try {
- audioNode.connect(context.destination, 0, 0);
- testPassed("audioNode.connect(context.destination) succeeded.");
- } catch(e) {
- testFailed("audioNode.connect(context.destination) failed.");
- }
+ shouldThrow('audioNode.connect(0, 0, 0)');
+ shouldThrow('audioNode.connect(null, 0, 0)');
+ shouldThrow('audioNode.connect(context.destination, 5, 0)');
+ shouldThrow('audioNode.connect(context.destination, 0, 5)');
+
+ shouldNotThrow('audioNode.connect(context.destination, 0, 0)');
// Create a new context and try to connect the other context's node to this one.
try {
diff --git a/third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt b/third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt
index fb4e9b6..821196b2 100644
--- a/third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt
@@ -47,7 +47,7 @@ PASS node.smoothingTimeConstant is not -0.1
PASS node.smoothingTimeConstant = 1.5 threw exception IndexSizeError: Failed to set the 'smoothingTimeConstant' property on 'AnalyserNode': The smoothing value provided (1.5) is outside the range [0, 1]..
PASS node.smoothingTimeConstant is not 1.5
PASS node.getChannelData(2) threw exception IndexSizeError: Failed to execute 'getChannelData' on 'AudioBuffer': channel index (2) exceeds number of channels (1).
-PASS node.connect(null, 0, 0) threw exception SyntaxError: Failed to execute 'connect' on 'AudioNode': invalid destination node..
+PASS node.connect(null, 0, 0) threw exception TypeError: Failed to execute 'connect' on 'AudioNode': parameter 1 is not of type 'AudioNode'..
PASS node.connect(context.destination, 100, 0) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (100) exceeds number of outputs (1)..
PASS node.connect(context.destination, 0, 100) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (100) exceeds number of inputs (1)..
PASS node.connect(node2.gain, 100) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (100) exceeds number of outputs (1)..
diff --git a/third_party/WebKit/LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt b/third_party/WebKit/LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt
index c12ea96..5beecb7 100644
--- a/third_party/WebKit/LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS audioNode.numberOfInputs is 0
PASS audioNode.numberOfOutputs is 1
-PASS audioNode.connect(0, 0, 0) threw exception SyntaxError: Failed to execute 'connect' on 'AudioNode': invalid destination node..
+PASS audioNode.connect(0, 0, 0) threw exception TypeError: Failed to execute 'connect' on 'AudioNode': parameter 1 is not of type 'AudioNode'..
PASS audioNode.connect(context.destination, 5, 0) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (5) exceeds number of outputs (1)..
PASS audioNode.connect(context.destination, 0, 5) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (5) exceeds number of inputs (1)..
PASS audioNode.connect(context.destination, 0, 0) did not throw exception.
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
index 6f70860..02a19bd 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
@@ -198,13 +198,6 @@ void AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned i
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
- if (!destination) {
- exceptionState.throwDOMException(
- SyntaxError,
- "invalid destination node.");
- return;
- }
-
// Sanity check input and output indices.
if (outputIndex >= numberOfOutputs()) {
exceptionState.throwDOMException(
@@ -239,13 +232,6 @@ void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionState&
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
- if (!param) {
- exceptionState.throwDOMException(
- SyntaxError,
- "invalid AudioParam.");
- return;
- }
-
if (outputIndex >= numberOfOutputs()) {
exceptionState.throwDOMException(
IndexSizeError,
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.idl b/third_party/WebKit/Source/modules/webaudio/AudioNode.idl
index 9ba9f6e..9623af7 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNode.idl
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.idl
@@ -38,9 +38,9 @@ enum ChannelInterpretation {
[
Conditional=WEB_AUDIO,
GarbageCollected,
+ TypeChecking=Interface
] interface AudioNode : EventTarget {
- // FIXME: AudioNode argument should not be nullable
- [RaisesException] void connect(AudioNode? destination, optional unsigned long output = 0, optional unsigned long input = 0);
+ [RaisesException] void connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0);
[RaisesException] void connect(AudioParam destination, optional unsigned long output = 0);
[RaisesException] void disconnect(optional unsigned long output = 0);
readonly attribute AudioContext context;