⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267376 in webkit


Ignore:
Timestamp:
Sep 21, 2020, 3:50:47 PM (6 years ago)
Author:
Chris Dumez
Message:

Throw when AudioConnect::connect() is called for an output that has no channels
https://bugs.webkit.org/show_bug.cgi?id=216802

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline existing tests because I improved exception messages.

  • web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining-expected.txt:
  • web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-expected.txt:

Source/WebCore:

Throw when AudioConnect::connect() is called for an output that has no channels, for consistency
with Blink. The ScriptProcessorNode cannot have an output node that has zero channels.

No new tests, rebaselined existing tests.

  • Modules/webaudio/AudioNode.cpp:

(WebCore::AudioNode::connect):

LayoutTests:

  • webaudio/MediaElementAudioSource/mediaelementaudiosourcenode-expected.txt:
  • webaudio/dom-exceptions-expected.txt:

Rebaseline existing tests because I improved exception messages.

  • webaudio/ScriptProcessor/scriptprocessornode-0-output-channels-expected.txt:

Rebaseline test that is now passing.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267369 r267376  
     12020-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Throw when AudioConnect::connect() is called for an output that has no channels
     4        https://bugs.webkit.org/show_bug.cgi?id=216802
     5
     6        Reviewed by Darin Adler.
     7
     8        * webaudio/MediaElementAudioSource/mediaelementaudiosourcenode-expected.txt:
     9        * webaudio/dom-exceptions-expected.txt:
     10        Rebaseline existing tests because I improved exception messages.
     11
     12        * webaudio/ScriptProcessor/scriptprocessornode-0-output-channels-expected.txt:
     13        Rebaseline test that is now passing.
     14
    1152020-09-21  Jiewen Tan  <jiewen_tan@apple.com>
    216
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r267357 r267376  
     12020-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Throw when AudioConnect::connect() is called for an output that has no channels
     4        https://bugs.webkit.org/show_bug.cgi?id=216802
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline existing tests because I improved exception messages.
     9
     10        * web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining-expected.txt:
     11        * web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-expected.txt:
     12
    1132020-09-21  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-connect-method-chaining-expected.txt

    r265962 r267376  
    5959PASS < [media-group] All assertions passed. (total 6 assertions)
    6060PASS > [invalid-operation] 
    61 PASS   Connecting with an invalid output threw IndexSizeError: "The index is not in the allowed range.".
    62 PASS   Connecting to a node from the different context threw SyntaxError: "The string did not match the expected pattern.".
     61PASS   Connecting with an invalid output threw IndexSizeError: "Output index exceeds number of outputs".
     62PASS   Connecting to a node from the different context threw SyntaxError: "Source and destination nodes belong to different audio contexts".
    6363PASS < [invalid-operation] All assertions passed. (total 2 assertions)
    6464PASS > [verification] 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-expected.txt

    r264342 r267376  
    1010PASS   audioNode.connect(0, 0, 0) threw TypeError: "Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode".
    1111PASS   audioNode.connect(null, 0, 0) threw TypeError: "Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode".
    12 PASS   audioNode.connect(context.destination, 5, 0) threw IndexSizeError: "The index is not in the allowed range.".
    13 PASS   audioNode.connect(context.destination, 0, 5) threw IndexSizeError: "The index is not in the allowed range.".
     12PASS   audioNode.connect(context.destination, 5, 0) threw IndexSizeError: "Output index exceeds number of outputs".
     13PASS   audioNode.connect(context.destination, 0, 5) threw IndexSizeError: "Input index exceeds number of inputs".
    1414PASS   audioNode.connect(context.destination, 0, 0) did not throw an exception.
    15 PASS   Connecting a node to a different context threw SyntaxError: "The string did not match the expected pattern.".
     15PASS   Connecting a node to a different context threw SyntaxError: "Source and destination nodes belong to different audio contexts".
    1616PASS   context3 = new AudioContext(1, 44100, 44100) threw TypeError: "Type error".
    1717PASS   AudioNode is an EventTarget is true.
  • trunk/LayoutTests/webaudio/MediaElementAudioSource/mediaelementaudiosourcenode-expected.txt

    r267307 r267376  
    77PASS   audioNode.numberOfOutputs is equal to 1.
    88PASS   audioNode.connect(0, 0, 0) threw TypeError: "Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode".
    9 PASS   audioNode.connect(context.destination, 5, 0) threw IndexSizeError: "The index is not in the allowed range.".
    10 PASS   audioNode.connect(context.destination, 0, 5) threw IndexSizeError: "The index is not in the allowed range.".
     9PASS   audioNode.connect(context.destination, 5, 0) threw IndexSizeError: "Output index exceeds number of outputs".
     10PASS   audioNode.connect(context.destination, 0, 5) threw IndexSizeError: "Input index exceeds number of inputs".
    1111PASS   mediaSource.mediaElement instanceof HTMLMediaElement is true.
    1212PASS   mediaSource.mediaElement is same object is true.
  • trunk/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-0-output-channels-expected.txt

    r267307 r267376  
    1111PASS < [initialize] All assertions passed. (total 4 assertions)
    1212PASS > [test] 
    13 FAIL X scriptNode1.connect(analyzer) did not throw an exception. assert_true: expected true got false
     13PASS   scriptNode1.connect(analyzer) threw InvalidAccessError: "Node has zero output channels".
    1414PASS   scriptNode2.connect(analyzer) did not throw an exception.
    15 FAIL < [test] 1 out of 2 assertions were failed. assert_true: expected true got false
    16 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 2 tasks were failed. assert_true: expected true got false
     15PASS < [test] All assertions passed. (total 2 assertions)
     16PASS # AUDIT TASK RUNNER FINISHED: 2 tasks ran successfully.
    1717
  • trunk/LayoutTests/webaudio/dom-exceptions-expected.txt

    r267151 r267376  
    104104PASS > [connections] AudioNode connections
    105105PASS   node.connect(null, 0, 0) threw TypeError: "Argument 1 ('destination') to AudioNode.connect must be an instance of AudioNode".
    106 PASS   node.connect(context.destination, 100, 0) threw IndexSizeError: "The index is not in the allowed range.".
    107 PASS   node.connect(context.destination, 0, 100) threw IndexSizeError: "The index is not in the allowed range.".
    108 PASS   node.connect(node2.gain, 100) threw IndexSizeError: "The index is not in the allowed range.".
     106PASS   node.connect(context.destination, 100, 0) threw IndexSizeError: "Output index exceeds number of outputs".
     107PASS   node.connect(context.destination, 0, 100) threw IndexSizeError: "Input index exceeds number of inputs".
     108PASS   node.connect(node2.gain, 100) threw IndexSizeError: "Output index exceeds number of outputs".
    109109PASS   node.disconnect(99) threw IndexSizeError: "output index is out of bounds".
    110 PASS   node.connect(otherContext.destination) threw SyntaxError: "The string did not match the expected pattern.".
     110PASS   node.connect(otherContext.destination) threw SyntaxError: "Source and destination nodes belong to different audio contexts".
    111111PASS < [connections] All assertions passed. (total 6 assertions)
    112112PASS > [channel-stuff] channelCount, channelCountMode, channelInterpretation
  • trunk/Source/WebCore/ChangeLog

    r267373 r267376  
     12020-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Throw when AudioConnect::connect() is called for an output that has no channels
     4        https://bugs.webkit.org/show_bug.cgi?id=216802
     5
     6        Reviewed by Darin Adler.
     7
     8        Throw when AudioConnect::connect() is called for an output that has no channels, for consistency
     9        with Blink. The ScriptProcessorNode cannot have an output node that has zero channels.
     10
     11        No new tests, rebaselined existing tests.
     12
     13        * Modules/webaudio/AudioNode.cpp:
     14        (WebCore::AudioNode::connect):
     15
    1162020-09-21  Yusuke Suzuki  <ysuzuki@apple.com>
    217
  • trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp

    r266559 r267376  
    196196    // Sanity check input and output indices.
    197197    if (outputIndex >= numberOfOutputs())
    198         return Exception { IndexSizeError };
     198        return Exception { IndexSizeError, "Output index exceeds number of outputs"_s };
    199199
    200200    if (inputIndex >= destination.numberOfInputs())
    201         return Exception { IndexSizeError };
     201        return Exception { IndexSizeError, "Input index exceeds number of inputs"_s };
    202202
    203203    if (&context() != &destination.context())
    204         return Exception { SyntaxError };
     204        return Exception { SyntaxError, "Source and destination nodes belong to different audio contexts"_s };
    205205
    206206    auto* input = destination.input(inputIndex);
    207207    auto* output = this->output(outputIndex);
     208
     209    if (!output->numberOfChannels())
     210        return Exception { InvalidAccessError, "Node has zero output channels"_s };
     211
    208212    input->connect(output);
    209213
     
    225229
    226230    if (outputIndex >= numberOfOutputs())
    227         return Exception { IndexSizeError };
     231        return Exception { IndexSizeError, "Output index exceeds number of outputs"_s };
    228232
    229233    if (&context() != &param.context())
    230         return Exception { SyntaxError };
     234        return Exception { SyntaxError, "Node and AudioParam belong to different audio contexts"_s };
    231235
    232236    auto* output = this->output(outputIndex);
Note: See TracChangeset for help on using the changeset viewer.