Diff
Modified: trunk/LayoutTests/ChangeLog (106578 => 106579)
--- trunk/LayoutTests/ChangeLog 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/LayoutTests/ChangeLog 2012-02-02 20:29:20 UTC (rev 106579)
@@ -1,3 +1,16 @@
+2012-02-02 Raymond Toy <[email protected]>
+
+ 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 <[email protected]>
Unreviewed, chromium expectations update.
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (106578 => 106579)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-02 20:29:20 UTC (rev 106579)
@@ -3819,8 +3819,6 @@
// 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
Modified: trunk/LayoutTests/webaudio/panner-set-model-expected.txt (106578 => 106579)
--- trunk/LayoutTests/webaudio/panner-set-model-expected.txt 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/LayoutTests/webaudio/panner-set-model-expected.txt 2012-02-02 20:29:20 UTC (rev 106579)
@@ -4,8 +4,8 @@
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
Modified: trunk/LayoutTests/webaudio/panner-set-model.html (106578 => 106579)
--- trunk/LayoutTests/webaudio/panner-set-model.html 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/LayoutTests/webaudio/panner-set-model.html 2012-02-02 20:29:20 UTC (rev 106579)
@@ -44,23 +44,24 @@
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) {
Modified: trunk/Source/WebCore/ChangeLog (106578 => 106579)
--- trunk/Source/WebCore/ChangeLog 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/Source/WebCore/ChangeLog 2012-02-02 20:29:20 UTC (rev 106579)
@@ -1,3 +1,21 @@
+2012-02-02 Raymond Toy <[email protected]>
+
+ 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 <[email protected]>
Rename [ConvertUndefinedOrNullToNullString] to
Modified: trunk/Source/WebCore/webaudio/AudioPannerNode.cpp (106578 => 106579)
--- trunk/Source/WebCore/webaudio/AudioPannerNode.cpp 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/Source/WebCore/webaudio/AudioPannerNode.cpp 2012-02-02 20:29:20 UTC (rev 106579)
@@ -33,6 +33,7 @@
#include "AudioContext.h"
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
+#include "ExceptionCode.h"
#include "HRTFPanner.h"
#include <wtf/MathExtras.h>
@@ -150,20 +151,22 @@
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;
}
}
Modified: trunk/Source/WebCore/webaudio/AudioPannerNode.h (106578 => 106579)
--- trunk/Source/WebCore/webaudio/AudioPannerNode.h 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/Source/WebCore/webaudio/AudioPannerNode.h 2012-02-02 20:29:20 UTC (rev 106579)
@@ -72,7 +72,7 @@
// 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; }
Modified: trunk/Source/WebCore/webaudio/AudioPannerNode.idl (106578 => 106579)
--- trunk/Source/WebCore/webaudio/AudioPannerNode.idl 2012-02-02 20:02:39 UTC (rev 106578)
+++ trunk/Source/WebCore/webaudio/AudioPannerNode.idl 2012-02-02 20:29:20 UTC (rev 106579)
@@ -33,7 +33,9 @@
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);