Bug 1415805 - throw exception at region.lines setter if value is negative. r=smaug
MozReview-Commit-ID: 2SMJGQBFpgJ
--- a/dom/media/TextTrackRegion.h
+++ b/dom/media/TextTrackRegion.h
@@ -42,19 +42,23 @@ public:
static already_AddRefed<TextTrackRegion>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
double Lines() const
{
return mLines;
}
- void SetLines(double aLines)
+ void SetLines(double aLines, ErrorResult& aRv)
{
- mLines = aLines;
+ if (aLines < 0) {
+ aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
+ } else {
+ mLines = aLines;
+ }
}
double Width() const
{
return mWidth;
}
void SetWidth(double aWidth, ErrorResult& aRv)
--- a/dom/webidl/VTTRegion.webidl
+++ b/dom/webidl/VTTRegion.webidl
@@ -7,19 +7,18 @@
* http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
*/
[Constructor, Pref="media.webvtt.regions.enabled"]
interface VTTRegion {
attribute DOMString id;
[SetterThrows]
attribute double width;
-
+ [SetterThrows]
attribute long lines;
-
[SetterThrows]
attribute double regionAnchorX;
[SetterThrows]
attribute double regionAnchorY;
[SetterThrows]
attribute double viewportAnchorX;
[SetterThrows]
attribute double viewportAnchorY;