https://bugs.webkit.org/show_bug.cgi?id=77235
Patch by Raymond Toy <rtoy@google.com> 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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106579
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-02 Raymond Toy <rtoy@google.com>
+
+ Illegal panner model values should throw an exception
+ https://bugs.webkit.org/show_bug.cgi?id=77235
+
+ Reviewed by Kenneth Russell.
+
+ * 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.
+
2012-02-02 Nate Chapin <japhet@chromium.org>
Unreviewed, chromium expectations update.
// Started failing at http://trac.webkit.org/changeset/105007
BUGCR110365 WIN : webaudio/gain.html = PASS AUDIO
-BUGWK77283 DEBUG : webaudio/panner-set-model.html = CRASH
-
BUGWK76488 : css3/images/cross-fade-background-size.html = IMAGE IMAGE+TEXT
BUGKW76557 : svg/custom/transform-with-shadow-and-gradient.svg = IMAGE
PASS Panner set to EQUALPOWER model and read correctly.
PASS Panner set to HRTF model and read correctly.
-PASS Panner set to SOUNDFIELD model and read correctly.
-PASS Panner set to invalid model and panningModel did not change.
+PASS Setting panner model to SOUNDFIELD correctly throws exception because it is not implemented.
+PASS Illegal panner model correctly throws exception.
PASS Panning model tests passed.
PASS successfullyParsed is true
testFailed("Panner model set to HRTF (1) but returned " + panner.panningModel);
success = false;
}
-
- panner.panningModel = panner.SOUNDFIELD;
- if (panner.panningModel == 2) {
- testPassed("Panner set to SOUNDFIELD model and read correctly.");
- } else {
- testFailed("Panner model set to SOUNDFIELD (2) but returned " + panner.panningModel);
+
+ // SOUNDFIELD should throw exception because it is not
+ // currently implemented. (See https://bugs.webkit.org/show_bug.cgi?id=77367)
+ try {
+ panner.panningModel = panner.SOUNDFIELD;
+ testFailed("Setting panner model to SOUNDFIELD should throw exception because it is not implemented.");
success = false;
+ } catch(e) {
+ testPassed("Setting panner model to SOUNDFIELD correctly throws exception because it is not implemented.");
}
- // Set to invalid value and make sure it didn't change from
- // it's previous setting (of 2).
- panner.panningModel = 99;
- if (panner.panningModel == 2) {
- testPassed("Panner set to invalid model and panningModel did not change.");
- } else {
- testFailed("Panner set to invalid model, but the panningModel changed from 2 to " + panner.panningModel);
+ // Other invalid models should throw an exception.
+ try {
+ panner.panningModel = 99;
+ testFailed("Illegal panner model should throw exception.");
success = false;
+ } catch(e) {
+ testPassed("Illegal panner model correctly throws exception.");
}
if (success) {
+2012-02-02 Raymond Toy <rtoy@google.com>
+
+ Illegal panner model values should throw an exception
+ https://bugs.webkit.org/show_bug.cgi?id=77235
+
+ Reviewed by Kenneth Russell.
+
+ 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.
+
2012-02-02 Kentaro Hara <haraken@chromium.org>
Rename [ConvertUndefinedOrNullToNullString] to
#include "AudioContext.h"
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
+#include "ExceptionCode.h"
#include "HRTFPanner.h"
#include <wtf/MathExtras.h>
return context()->listener();
}
-void AudioPannerNode::setPanningModel(unsigned short model)
+void AudioPannerNode::setPanningModel(unsigned short model, ExceptionCode& ec)
{
switch (model) {
case EQUALPOWER:
case HRTF:
- case SOUNDFIELD:
if (!m_panner.get() || model != m_panningModel) {
OwnPtr<Panner> newPanner = Panner::create(model, sampleRate());
m_panner = newPanner.release();
m_panningModel = model;
}
break;
+ case SOUNDFIELD:
+ // FIXME: Implement sound field model. See // https://bugs.webkit.org/show_bug.cgi?id=77367.
+ // For now, fall through to throw an exception.
default:
- // FIXME: consider throwing an exception for illegal model values.
+ ec = NOT_SUPPORTED_ERR;
break;
}
}
// Panning model
unsigned short panningModel() const { return m_panningModel; }
- void setPanningModel(unsigned short);
+ void setPanningModel(unsigned short, ExceptionCode&);
// Position
FloatPoint3D position() const { return m_position; }
const unsigned short SOUNDFIELD = 2;
// Default model for stereo is HRTF
- attribute unsigned long panningModel; // FIXME: use unsigned short when glue generation supports it
+ // FIXME: use unsigned short when glue generation supports it
+ attribute unsigned long panningModel
+ setter raises(DOMException);
// Uses a 3D cartesian coordinate system
void setPosition(in float x, in float y, in float z);