<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207672] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207672">207672</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-21 09:09:28 -0700 (Fri, 21 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>AudioNode.connect(): First parameter should not be nullable
https://bugs.webkit.org/show_bug.cgi?id=163773
Reviewed by Darin Adler.
Source/WebCore:
AudioNode.connect()'s first parameter should not be nullable:
- https://webaudio.github.io/web-audio-api/#idl-def-AudioNode.
We were throwing a SYNTAX_ERR when passing null, we now throw
a TypeError instead.
No new tests, updated existing test.
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::connect):
* Modules/webaudio/AudioBasicInspectorNode.h:
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect):
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/AudioNode.idl:
LayoutTests:
Improve test coverage.
* webaudio/audionode-expected.txt:
* webaudio/audionode.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestswebaudioaudionodeexpectedtxt">trunk/LayoutTests/webaudio/audionode-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebaudioaudionodehtml">trunk/LayoutTests/webaudio/audionode.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodeh">trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodeh">trunk/Source/WebCore/Modules/webaudio/AudioNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodeidl">trunk/Source/WebCore/Modules/webaudio/AudioNode.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/LayoutTests/ChangeLog        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-10-21 Chris Dumez <cdumez@apple.com>
+
+ AudioNode.connect(): First parameter should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=163773
+
+ Reviewed by Darin Adler.
+
+ Improve test coverage.
+
+ * webaudio/audionode-expected.txt:
+ * webaudio/audionode.html:
+
</ins><span class="cx"> 2016-10-21 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Implement InputEvent.getTargetRanges() for the input events spec
</span></span></pre></div>
<a id="trunkLayoutTestswebaudioaudionodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webaudio/audionode-expected.txt (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webaudio/audionode-expected.txt        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/LayoutTests/webaudio/audionode-expected.txt        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -6,7 +6,8 @@
</span><span class="cx"> PASS Source AudioNode has one output.
</span><span class="cx"> PASS Destination AudioNode has one input.
</span><span class="cx"> PASS Destination AudioNode has no outputs.
</span><del>-PASS connect() exception thrown for illegal destination AudioNode.
</del><ins>+PASS audioNode.connect(0, 0, 0) threw exception TypeError: Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode.
+PASS audioNode.connect(null, 0, 0) threw exception TypeError: Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode.
</ins><span class="cx"> PASS connect() exception thrown for illegal output index.
</span><span class="cx"> PASS connect() exception thrown for illegal input index.
</span><span class="cx"> PASS audioNode.connect(context.destination) succeeded.
</span></span></pre></div>
<a id="trunkLayoutTestswebaudioaudionodehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webaudio/audionode.html (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webaudio/audionode.html        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/LayoutTests/webaudio/audionode.html        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -51,12 +51,8 @@
</span><span class="cx">
</span><span class="cx"> // Try calling connect() method with illegal values.
</span><span class="cx">
</span><del>- 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.");
- }
</del><ins>+ shouldThrowErrorName("audioNode.connect(0, 0, 0)", "TypeError");
+ shouldThrowErrorName("audioNode.connect(null, 0, 0)", "TypeError");
</ins><span class="cx">
</span><span class="cx"> try {
</span><span class="cx"> audioNode.connect(context.destination, 5, 0);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/ChangeLog        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-10-21 Chris Dumez <cdumez@apple.com>
+
+ AudioNode.connect(): First parameter should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=163773
+
+ Reviewed by Darin Adler.
+
+ AudioNode.connect()'s first parameter should not be nullable:
+ - https://webaudio.github.io/web-audio-api/#idl-def-AudioNode.
+
+ We were throwing a SYNTAX_ERR when passing null, we now throw
+ a TypeError instead.
+
+ No new tests, updated existing test.
+
+ * Modules/webaudio/AudioBasicInspectorNode.cpp:
+ (WebCore::AudioBasicInspectorNode::connect):
+ * Modules/webaudio/AudioBasicInspectorNode.h:
+ * Modules/webaudio/AudioNode.cpp:
+ (WebCore::AudioNode::connect):
+ * Modules/webaudio/AudioNode.h:
+ * Modules/webaudio/AudioNode.idl:
+
</ins><span class="cx"> 2016-10-21 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Implement InputEvent.getTargetRanges() for the input events spec
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> input(0)->pull(output(0)->bus(), framesToProcess);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> AudioBasicInspectorNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex)
</del><ins>+ExceptionOr<void> AudioBasicInspectorNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void pullInputs(size_t framesToProcess) override;
</span><del>- ExceptionOr<void> connect(AudioNode*, unsigned outputIndex, unsigned inputIndex) override;
</del><ins>+ ExceptionOr<void> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex) override;
</ins><span class="cx"> ExceptionOr<void> disconnect(unsigned outputIndex) override;
</span><span class="cx"> void checkNumberOfChannelsForInput(AudioNodeInput*) override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -123,25 +123,22 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex)
</del><ins>+ExceptionOr<void> AudioNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- if (!destination)
- return Exception { SYNTAX_ERR };
-
</del><span class="cx"> // Sanity check input and output indices.
</span><span class="cx"> if (outputIndex >= numberOfOutputs())
</span><span class="cx"> return Exception { INDEX_SIZE_ERR };
</span><span class="cx">
</span><del>- if (destination && inputIndex >= destination->numberOfInputs())
</del><ins>+ if (inputIndex >= destination.numberOfInputs())
</ins><span class="cx"> return Exception { INDEX_SIZE_ERR };
</span><span class="cx">
</span><del>- if (context() != destination->context())
</del><ins>+ if (context() != destination.context())
</ins><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span><del>- auto* input = destination->input(inputIndex);
</del><ins>+ auto* input = destination.input(inputIndex);
</ins><span class="cx"> auto* output = this->output(outputIndex);
</span><span class="cx"> input->connect(output);
</span><span class="cx">
</span><span class="lines">@@ -151,22 +148,19 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> AudioNode::connect(AudioParam* param, unsigned outputIndex)
</del><ins>+ExceptionOr<void> AudioNode::connect(AudioParam& param, unsigned outputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- if (!param)
- return Exception { SYNTAX_ERR };
-
</del><span class="cx"> if (outputIndex >= numberOfOutputs())
</span><span class="cx"> return Exception { INDEX_SIZE_ERR };
</span><span class="cx">
</span><del>- if (context() != param->context())
</del><ins>+ if (context() != param.context())
</ins><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span><span class="cx"> auto* output = this->output(outputIndex);
</span><del>- param->connect(output);
</del><ins>+ param.connect(output);
</ins><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.h (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.h        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.h        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -121,8 +121,8 @@
</span><span class="cx"> AudioNodeOutput* output(unsigned);
</span><span class="cx">
</span><span class="cx"> // Called from main thread by corresponding JavaScript methods.
</span><del>- virtual ExceptionOr<void> connect(AudioNode*, unsigned outputIndex, unsigned inputIndex);
- ExceptionOr<void> connect(AudioParam*, unsigned outputIndex);
</del><ins>+ virtual ExceptionOr<void> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex);
+ ExceptionOr<void> connect(AudioParam&, unsigned outputIndex);
</ins><span class="cx"> virtual ExceptionOr<void> disconnect(unsigned outputIndex);
</span><span class="cx">
</span><span class="cx"> virtual float sampleRate() const { return m_sampleRate; }
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.idl (207671 => 207672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.idl        2016-10-21 16:02:39 UTC (rev 207671)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.idl        2016-10-21 16:09:28 UTC (rev 207672)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> [SetterMayThrowException] attribute DOMString channelCountMode;
</span><span class="cx"> [SetterMayThrowException] attribute DOMString channelInterpretation;
</span><span class="cx">
</span><del>- [MayThrowException] void connect(AudioNode? destination, optional unsigned long output = 0, optional unsigned long input = 0);
- [MayThrowException] void connect(AudioParam? destination, optional unsigned long output = 0);
</del><ins>+ [MayThrowException] void connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0);
+ [MayThrowException] void connect(AudioParam destination, optional unsigned long output = 0);
</ins><span class="cx"> [MayThrowException] void disconnect(optional unsigned long output = 0);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>