Changeset 267066 in webkit


Ignore:
Timestamp:
Sep 14, 2020 6:59:20 PM (4 years ago)
Author:
Chris Dumez
Message:

Type of AnalyserNode's attributes should not be unrestricted double
https://bugs.webkit.org/show_bug.cgi?id=216505

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline existing WPT test now that the exception message was improved.

  • web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser-expected.txt:

Source/WebCore:

Type of AnalyserNode's attributes should not be unrestricted double. They should use double type
so that we throw when trying to set them to NaN or infinity values.

No new tests, updated existing test.

  • Modules/webaudio/AnalyserNode.cpp:

(WebCore::AnalyserNode::setSmoothingTimeConstant):

  • Modules/webaudio/AnalyserNode.idl:

LayoutTests:

Extend layout test coverage.

  • webaudio/analyser-exception-expected.txt:
  • webaudio/analyser-exception.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267065 r267066  
     12020-09-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Type of AnalyserNode's attributes should not be unrestricted double
     4        https://bugs.webkit.org/show_bug.cgi?id=216505
     5
     6        Reviewed by Darin Adler.
     7
     8        Extend layout test coverage.
     9
     10        * webaudio/analyser-exception-expected.txt:
     11        * webaudio/analyser-exception.html:
     12
    1132020-09-14  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r267060 r267066  
     12020-09-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Type of AnalyserNode's attributes should not be unrestricted double
     4        https://bugs.webkit.org/show_bug.cgi?id=216505
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline existing WPT test now that the exception message was improved.
     9
     10        * web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser-expected.txt:
     11
    1122020-09-14  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/ctor-analyser-expected.txt

    r266559 r267066  
    6565PASS   node = new AnalyserNode(c, { maxDecibels: -500 }) threw IndexSizeError: "minDecibels must be less than maxDecibels.".
    6666PASS   node = new AnalyserNode(c, { minDecibels: -10 }) threw IndexSizeError: "minDecibels must be less than maxDecibels.".
    67 PASS   node = new AnalyserNode(c, { smoothingTimeConstant: 2 }) threw IndexSizeError: "The index is not in the allowed range.".
     67PASS   node = new AnalyserNode(c, { smoothingTimeConstant: 2 }) threw IndexSizeError: "Smoothing time constant needs to be between 0 and 1.".
    6868PASS   node = new AnalyserNode(c, { frequencyBinCount: 33 }) did not throw an exception.
    6969PASS   node.frequencyBinCount is equal to 1024.
  • trunk/LayoutTests/webaudio/analyser-exception-expected.txt

    r265196 r267066  
    44
    55PASS analyser.minDecibels = -20 threw exception IndexSizeError: minDecibels must be less than maxDecibels..
     6PASS analyser.minDecibels = NaN threw exception TypeError: The provided value is non-finite.
     7PASS analyser.minDecibels = Infinity threw exception TypeError: The provided value is non-finite.
     8PASS analyser.minDecibels = -Infinity threw exception TypeError: The provided value is non-finite.
    69PASS analyser.maxDecibels = -120 threw exception IndexSizeError: maxDecibels must be greater than minDecibels..
    7 PASS analyser.smoothingTimeConstant = 2 threw exception IndexSizeError: The index is not in the allowed range..
     10PASS analyser.maxDecibels = NaN threw exception TypeError: The provided value is non-finite.
     11PASS analyser.maxDecibels = Infinity threw exception TypeError: The provided value is non-finite.
     12PASS analyser.maxDecibels = -Infinity threw exception TypeError: The provided value is non-finite.
     13PASS analyser.smoothingTimeConstant = 2 threw exception IndexSizeError: Smoothing time constant needs to be between 0 and 1..
     14PASS analyser.smoothingTimeConstant = -1 threw exception IndexSizeError: Smoothing time constant needs to be between 0 and 1..
     15PASS analyser.smoothingTimeConstant = NaN threw exception TypeError: The provided value is non-finite.
     16PASS analyser.smoothingTimeConstant = Infinity threw exception TypeError: The provided value is non-finite.
     17PASS analyser.smoothingTimeConstant = -Infinity threw exception TypeError: The provided value is non-finite.
    818PASS successfullyParsed is true
    919
  • trunk/LayoutTests/webaudio/analyser-exception.html

    r219663 r267066  
    2929    // 'minDecibels' shouldn't be greater than 'maxDecibels' which defaults to -30dB.
    3030    shouldThrowErrorName("analyser.minDecibels = -20", "IndexSizeError");
     31    shouldThrowErrorName("analyser.minDecibels = NaN", "TypeError");
     32    shouldThrowErrorName("analyser.minDecibels = Infinity", "TypeError");
     33    shouldThrowErrorName("analyser.minDecibels = -Infinity", "TypeError");
    3134
    3235    // 'maxDecibels' shouldn't be less than 'minDecibels' which defaults to -100dB.
    3336    shouldThrowErrorName("analyser.maxDecibels = -120", "IndexSizeError");
     37    shouldThrowErrorName("analyser.maxDecibels = NaN", "TypeError");
     38    shouldThrowErrorName("analyser.maxDecibels = Infinity", "TypeError");
     39    shouldThrowErrorName("analyser.maxDecibels = -Infinity", "TypeError");
    3440
    3541    // 'smoothingTimeConstant' range is between 0 and 1.
    3642    shouldThrowErrorName("analyser.smoothingTimeConstant = 2", "IndexSizeError");
     43    shouldThrowErrorName("analyser.smoothingTimeConstant = -1", "IndexSizeError");
     44    shouldThrowErrorName("analyser.smoothingTimeConstant = NaN", "TypeError");
     45    shouldThrowErrorName("analyser.smoothingTimeConstant = Infinity", "TypeError");
     46    shouldThrowErrorName("analyser.smoothingTimeConstant = -Infinity", "TypeError");
    3747
    3848    context.oncomplete = finishJSTest;
  • trunk/Source/WebCore/ChangeLog

    r267065 r267066  
     12020-09-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Type of AnalyserNode's attributes should not be unrestricted double
     4        https://bugs.webkit.org/show_bug.cgi?id=216505
     5
     6        Reviewed by Darin Adler.
     7
     8        Type of AnalyserNode's attributes should not be unrestricted double. They should use double type
     9        so that we throw when trying to set them to NaN or infinity values.
     10
     11        No new tests, updated existing test.
     12
     13        * Modules/webaudio/AnalyserNode.cpp:
     14        (WebCore::AnalyserNode::setSmoothingTimeConstant):
     15        * Modules/webaudio/AnalyserNode.idl:
     16
    1172020-09-14  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp

    r266417 r267066  
    142142{
    143143    if (k < 0 || k > 1)
    144         return Exception { IndexSizeError };
     144        return Exception { IndexSizeError, "Smoothing time constant needs to be between 0 and 1."_s };
    145145
    146146    m_analyser.setSmoothingTimeConstant(k);
  • trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl

    r267007 r267066  
    3333
    3434    // minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values.
    35     attribute unrestricted double minDecibels;
    36     attribute unrestricted double maxDecibels;
     35    attribute double minDecibels;
     36    attribute double maxDecibels;
    3737
    3838    // A value from 0.0 -> 1.0 where 0.0 represents no time averaging with the last analysis frame.
    39     attribute unrestricted double smoothingTimeConstant;
     39    attribute double smoothingTimeConstant;
    4040
    4141    // Copies the current frequency data into the passed array.
Note: See TracChangeset for help on using the changeset viewer.