Bug 1400180 - Fix CID 1417508 Uninitialized members of TextTrackCue::mLine and mPosition by giving them default values. r=alwu
authorJames Cheng <jacheng@mozilla.com>
Fri, 15 Sep 2017 17:12:38 +0800
changeset 665576 2bf1aae5795a74407c9aad2dd8962aae433b03fc
parent 665575 3a173bcf1984255d88d8165a3798b7ae23db930c
child 665577 3baecf7b25f2d4a0d8cda5f773878a0f9d941ea5
push id80115
push userbmo:eoger@fastmail.com
push dateFri, 15 Sep 2017 18:29:01 +0000
reviewersalwu
bugs1400180, 1417508
milestone57.0a1
Bug 1400180 - Fix CID 1417508 Uninitialized members of TextTrackCue::mLine and mPosition by giving them default values. r=alwu MozReview-Commit-ID: CB6980MNqP1
dom/media/TextTrackCue.cpp
dom/media/TextTrackCue.h
--- a/dom/media/TextTrackCue.cpp
+++ b/dom/media/TextTrackCue.cpp
@@ -49,16 +49,18 @@ TextTrackCue::TextTrackCue(nsPIDOMWindow
                            double aStartTime,
                            double aEndTime,
                            const nsAString& aText,
                            ErrorResult& aRv)
   : DOMEventTargetHelper(aOwnerWindow)
   , mText(aText)
   , mStartTime(aStartTime)
   , mEndTime(aEndTime)
+  , mPosition(0.0)
+  , mLine(0.0)
   , mReset(false, "TextTrackCue::mReset")
   , mHaveStartedWatcher(false)
   , mWatchManager(this, GetOwnerGlobal()->AbstractMainThreadFor(TaskCategory::Other))
 {
   SetDefaultCueSettings();
   MOZ_ASSERT(aOwnerWindow);
   if (NS_FAILED(StashDocument())) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
@@ -71,16 +73,18 @@ TextTrackCue::TextTrackCue(nsPIDOMWindow
                            const nsAString& aText,
                            HTMLTrackElement* aTrackElement,
                            ErrorResult& aRv)
   : DOMEventTargetHelper(aOwnerWindow)
   , mText(aText)
   , mStartTime(aStartTime)
   , mEndTime(aEndTime)
   , mTrackElement(aTrackElement)
+  , mPosition(0.0)
+  , mLine(0.0)
   , mReset(false, "TextTrackCue::mReset")
   , mHaveStartedWatcher(false)
   , mWatchManager(this, GetOwnerGlobal()->AbstractMainThreadFor(TaskCategory::Other))
 {
   SetDefaultCueSettings();
   MOZ_ASSERT(aOwnerWindow);
   if (NS_FAILED(StashDocument())) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
--- a/dom/media/TextTrackCue.h
+++ b/dom/media/TextTrackCue.h
@@ -377,26 +377,26 @@ private:
   RefPtr<nsIDocument> mDocument;
   nsString mText;
   double mStartTime;
   double mEndTime;
 
   RefPtr<TextTrack> mTrack;
   RefPtr<HTMLTrackElement> mTrackElement;
   nsString mId;
-  MOZ_INIT_OUTSIDE_CTOR double mPosition;
+  double mPosition;
   bool mPositionIsAutoKeyword;
   PositionAlignSetting mPositionAlign;
   double mSize;
   bool mPauseOnExit;
   bool mSnapToLines;
   RefPtr<TextTrackRegion> mRegion;
   DirectionSetting mVertical;
   bool mLineIsAutoKeyword;
-  MOZ_INIT_OUTSIDE_CTOR double mLine;
+  double mLine;
   AlignSetting mAlign;
   LineAlignSetting mLineAlign;
 
   // Holds the computed DOM elements that represent the parsed cue text.
   // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-display-state
   RefPtr<nsGenericHTMLElement> mDisplayState;
   // Tells whether or not we need to recompute mDisplayState. This is set
   // anytime a property that relates to the display of the TextTrackCue is