Bug 1415805 - throw exception at region.lines setter if value is negative. r=smaug draft
authorbechen@mozilla.com <bechen@mozilla.com>
Wed, 22 Nov 2017 15:12:03 +0800
changeset 701796 a8a640636be0394d410bf4ba57f094525a4c92c4
parent 701700 e9648ee6c4ffa7dfaeb70c5e95f5634f2ed9531c
child 701797 34b5c39af3cab32f070335fd3cf183c45db2282a
push id90286
push userbmo:bechen@mozilla.com
push dateWed, 22 Nov 2017 09:21:12 +0000
reviewerssmaug
bugs1415805
milestone59.0a1
Bug 1415805 - throw exception at region.lines setter if value is negative. r=smaug MozReview-Commit-ID: 2SMJGQBFpgJ
dom/media/TextTrackRegion.h
dom/webidl/VTTRegion.webidl
--- 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;