Bug 454683 - "Media element setVolume should fail on invalid values" [r+sr=roc]

This commit is contained in:
Chris Pearce 2008-10-01 00:44:16 -05:00
parent 18bd325a4c
commit af37ffa177
3 changed files with 5 additions and 1 deletions

View File

@ -390,6 +390,9 @@ NS_IMETHODIMP nsHTMLMediaElement::GetVolume(float *aVolume)
NS_IMETHODIMP nsHTMLMediaElement::SetVolume(float aVolume)
{
if (aVolume < 0.0f || aVolume > 1.0f)
return NS_ERROR_DOM_INDEX_SIZE_ERR;
if (mMuted)
mMutedVolume = aVolume;
else {

View File

@ -53,6 +53,7 @@ _TEST_FILES = test_autoplay.html \
test_playbackRate.html \
test_readyState.html \
test_start.html \
test_volume.html \
# test_bug448534.html \
320x240.ogg \
$(NULL)

View File

@ -17,7 +17,7 @@ function test(element, value, shouldThrow) {
var threw = false;
try {
element.volume = value;
} catch (err if err == "NS_ERROR_DOM_INDEX_SIZE_ERR") {
} catch (err if err.name == "NS_ERROR_DOM_INDEX_SIZE_ERR") {
threw = true;
}
is(shouldThrow, threw, "Case: " +element.id+ " setVolume=" + value);