Changeset 106579 in webkit


Ignore:
Timestamp:
Feb 2, 2012 12:29:20 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Illegal panner model values should throw an exception
https://bugs.webkit.org/show_bug.cgi?id=77235

Patch by Raymond Toy <Raymond Toy> on 2012-02-02
Reviewed by Kenneth Russell.

Source/WebCore:

Modified existing panner-set-model test to catch exceptions.
Debug build should not crash anymore.

  • webaudio/AudioPannerNode.cpp:

(WebCore::AudioPannerNode::setPanningModel): Throw exception for
invalid model values.

  • webaudio/AudioPannerNode.h:

(AudioPannerNode): Update declaration

  • webaudio/AudioPannerNode.idl: Setting panner model can throw

exception.

LayoutTests:

  • webaudio/panner-set-model-expected.txt: Updated.
  • webaudio/panner-set-model.html: Catch the errors that are thrown

for invalid panning model values.

  • platform/chromium/test_expectations.txt: Remove test that no

longer crashes.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106578 r106579  
     12012-02-02  Raymond Toy  <rtoy@google.com>
     2
     3        Illegal panner model values should throw an exception
     4        https://bugs.webkit.org/show_bug.cgi?id=77235
     5
     6        Reviewed by Kenneth Russell.
     7
     8        * webaudio/panner-set-model-expected.txt: Updated.
     9        * webaudio/panner-set-model.html: Catch the errors that are thrown
     10        for invalid panning model values.
     11        * platform/chromium/test_expectations.txt: Remove test that no
     12        longer crashes.
     13
    1142012-02-02  Nate Chapin  <japhet@chromium.org>
    215
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r106578 r106579  
    38203820BUGCR110365 WIN : webaudio/gain.html = PASS AUDIO
    38213821
    3822 BUGWK77283 DEBUG : webaudio/panner-set-model.html = CRASH
    3823 
    38243822BUGWK76488 : css3/images/cross-fade-background-size.html = IMAGE IMAGE+TEXT
    38253823
  • trunk/LayoutTests/webaudio/panner-set-model-expected.txt

    r106174 r106579  
    55PASS Panner set to EQUALPOWER model and read correctly.
    66PASS Panner set to HRTF model and read correctly.
    7 PASS Panner set to SOUNDFIELD model and read correctly.
    8 PASS Panner set to invalid model and panningModel did not change.
     7PASS Setting panner model to SOUNDFIELD correctly throws exception because it is not implemented.
     8PASS Illegal panner model correctly throws exception.
    99PASS Panning model tests passed.
    1010PASS successfullyParsed is true
  • trunk/LayoutTests/webaudio/panner-set-model.html

    r106174 r106579  
    4545              success = false;
    4646          }
    47      
    48           panner.panningModel = panner.SOUNDFIELD;
    49           if (panner.panningModel == 2) {
    50               testPassed("Panner set to SOUNDFIELD model and read correctly.");
    51           } else {
    52               testFailed("Panner model set to SOUNDFIELD (2) but returned " + panner.panningModel);
     47
     48          // SOUNDFIELD should throw exception because it is not
     49          // currently implemented.  (See https://bugs.webkit.org/show_bug.cgi?id=77367)
     50          try {
     51              panner.panningModel = panner.SOUNDFIELD;
     52              testFailed("Setting panner model to SOUNDFIELD should throw exception because it is not implemented.");
    5353              success = false;
     54          } catch(e) {
     55              testPassed("Setting panner model to SOUNDFIELD correctly throws exception because it is not implemented.");
    5456          }
    5557
    56           // Set to invalid value and make sure it didn't change from
    57           // it's previous setting (of 2).
    58           panner.panningModel = 99;
    59           if (panner.panningModel == 2) {
    60               testPassed("Panner set to invalid model and panningModel did not change.");
    61           } else {
    62               testFailed("Panner set to invalid model, but the panningModel changed from 2 to " + panner.panningModel);
     58          // Other invalid models should throw an exception.
     59          try {
     60              panner.panningModel = 99;
     61              testFailed("Illegal panner model should throw exception.");
    6362              success = false;
     63          } catch(e) {
     64              testPassed("Illegal panner model correctly throws exception.");
    6465          }
    6566         
  • trunk/Source/WebCore/ChangeLog

    r106575 r106579  
     12012-02-02  Raymond Toy  <rtoy@google.com>
     2
     3        Illegal panner model values should throw an exception
     4        https://bugs.webkit.org/show_bug.cgi?id=77235
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Modified existing panner-set-model test to catch exceptions.
     9        Debug build should not crash anymore.
     10
     11        * webaudio/AudioPannerNode.cpp:
     12        (WebCore::AudioPannerNode::setPanningModel):  Throw exception for
     13        invalid model values.
     14        * webaudio/AudioPannerNode.h:
     15        (AudioPannerNode): Update declaration
     16        * webaudio/AudioPannerNode.idl: Setting panner model can throw
     17        exception.
     18
    1192012-02-02  Kentaro Hara  <haraken@chromium.org>
    220
  • trunk/Source/WebCore/webaudio/AudioPannerNode.cpp

    r106174 r106579  
    3434#include "AudioNodeInput.h"
    3535#include "AudioNodeOutput.h"
     36#include "ExceptionCode.h"
    3637#include "HRTFPanner.h"
    3738#include <wtf/MathExtras.h>
     
    151152}
    152153
    153 void AudioPannerNode::setPanningModel(unsigned short model)
     154void AudioPannerNode::setPanningModel(unsigned short model, ExceptionCode& ec)
    154155{
    155156    switch (model) {
    156157    case EQUALPOWER:
    157158    case HRTF:
    158     case SOUNDFIELD:
    159159        if (!m_panner.get() || model != m_panningModel) {
    160160            OwnPtr<Panner> newPanner = Panner::create(model, sampleRate());
     
    163163        }
    164164        break;
     165    case SOUNDFIELD:
     166        // FIXME: Implement sound field model. See // https://bugs.webkit.org/show_bug.cgi?id=77367.
     167        // For now, fall through to throw an exception.
    165168    default:
    166         // FIXME: consider throwing an exception for illegal model values.
     169        ec = NOT_SUPPORTED_ERR;
    167170        break;
    168171    }
  • trunk/Source/WebCore/webaudio/AudioPannerNode.h

    r104993 r106579  
    7373    // Panning model
    7474    unsigned short panningModel() const { return m_panningModel; }
    75     void setPanningModel(unsigned short);
     75    void setPanningModel(unsigned short, ExceptionCode&);
    7676
    7777    // Position
  • trunk/Source/WebCore/webaudio/AudioPannerNode.idl

    r106532 r106579  
    3434
    3535        // Default model for stereo is HRTF
    36         attribute unsigned long panningModel; // FIXME: use unsigned short when glue generation supports it
     36        // FIXME: use unsigned short when glue generation supports it
     37        attribute unsigned long panningModel
     38            setter raises(DOMException);
    3739
    3840        // Uses a 3D cartesian coordinate system
Note: See TracChangeset for help on using the changeset viewer.