зеркало из https://github.com/mozilla/gecko-dev.git
Bug 882743 - Make TextTrackCue setters throw. r=rillian, r=bz
From 8f5dccf7fd5f5d2a74341ead60586346e4ab3ead Mon Sep 17 00:00:00 2001 Now throwing javascript exceptions from attribute setters for TextTrack-related DOM classes. As can be seen in http://dev.w3.org/html5/webvtt/#webvtt-api, some of the attributes require validation and throwing. There is no validation implemented to the align property because there is a bug opened against the spec to change it to an Enum. When cleared, it should have the IDL changed to remove the throwing. Validation comments were removed from the properties that didn't have proper validation defined by the spec.
This commit is contained in:
Родитель
079c625713
Коммит
f8f34ffc6a
|
@ -86,7 +86,6 @@ public:
|
|||
|
||||
void SetStartTime(double aStartTime)
|
||||
{
|
||||
//XXXhumph: validate? bug 868519.
|
||||
if (mStartTime == aStartTime)
|
||||
return;
|
||||
|
||||
|
@ -101,7 +100,6 @@ public:
|
|||
|
||||
void SetEndTime(double aEndTime)
|
||||
{
|
||||
//XXXhumph: validate? bug 868519.
|
||||
if (mEndTime == aEndTime)
|
||||
return;
|
||||
|
||||
|
@ -128,11 +126,16 @@ public:
|
|||
aVertical = mVertical;
|
||||
}
|
||||
|
||||
void SetVertical(const nsAString& aVertical)
|
||||
void SetVertical(const nsAString& aVertical, ErrorResult& aRv)
|
||||
{
|
||||
if (mVertical == aVertical)
|
||||
return;
|
||||
|
||||
if (!aVertical.EqualsLiteral("rl") && !aVertical.EqualsLiteral("lr") && !aVertical.IsEmpty()){
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
mVertical = aVertical;
|
||||
CueChanged();
|
||||
|
@ -160,7 +163,7 @@ public:
|
|||
|
||||
void SetLine(double aLine)
|
||||
{
|
||||
//XXX: validate? bug 868519.
|
||||
//XXX: TODO Line position can be a keyword auto. bug882299
|
||||
mReset = true;
|
||||
mLine = aLine;
|
||||
}
|
||||
|
@ -170,12 +173,17 @@ public:
|
|||
return mPosition;
|
||||
}
|
||||
|
||||
void SetPosition(int32_t aPosition)
|
||||
void SetPosition(int32_t aPosition, ErrorResult& aRv)
|
||||
{
|
||||
// XXXhumph: validate? bug 868519.
|
||||
if (mPosition == aPosition)
|
||||
return;
|
||||
|
||||
if (aPosition > 100 || aPosition < 0){
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
mPosition = aPosition;
|
||||
CueChanged();
|
||||
|
@ -186,14 +194,15 @@ public:
|
|||
return mSize;
|
||||
}
|
||||
|
||||
void SetSize(int32_t aSize)
|
||||
void SetSize(int32_t aSize, ErrorResult& aRv)
|
||||
{
|
||||
if (mSize == aSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aSize < 0 || aSize > 100) {
|
||||
//XXX:throw IndexSizeError; bug 868519.
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
|
@ -223,7 +232,6 @@ public:
|
|||
|
||||
void SetText(const nsAString& aText)
|
||||
{
|
||||
// XXXhumph: validate? bug 868519.
|
||||
if (mText == aText)
|
||||
return;
|
||||
|
||||
|
|
|
@ -28,11 +28,14 @@ interface TextTrackCue : EventTarget {
|
|||
attribute double startTime;
|
||||
attribute double endTime;
|
||||
attribute boolean pauseOnExit;
|
||||
[SetterThrows]
|
||||
attribute DOMString vertical;
|
||||
attribute boolean snapToLines;
|
||||
// XXXhumph: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20651
|
||||
// attribute (long or AutoKeyword) line;
|
||||
[SetterThrows]
|
||||
attribute long position;
|
||||
[SetterThrows]
|
||||
attribute long size;
|
||||
attribute TextTrackCueAlign align;
|
||||
attribute DOMString text;
|
||||
|
|
Загрузка…
Ссылка в новой задаче