Bug 1415805 - throw exception at region.lines setter if value is negative. r=smaug
☠☠ backed out by 48c532b07ee7 ☠ ☠
authorbechen@mozilla.com <bechen@mozilla.com>
Wed, 22 Nov 2017 15:12:03 +0800
changeset 437967 fa895478ed712d06b3d7ccb49553d359a087193b
parent 437966 2d9ecef9d58feaf7b1764066f3b50c81d807735e
child 437968 ddfad494a32355275a1da25fd51fd414af369015
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +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;