Bug 1231378 - part 5 - Fix uninitialized members of classes in dom/{workers,events,media,canvas}, r=smaug
☠☠ backed out by e552329e232f ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 12 Jan 2016 13:57:37 +0000
changeset 314707 6d08ab04a77c8c7bdef78224e43968cd33bd8ade
parent 314706 d6b0ffe1a7b3a14cd40882c9fbcf644b0984ade8
child 314708 6aee1612510b7b5b7b02581e99abfa7f6cb74601
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1231378
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1231378 - part 5 - Fix uninitialized members of classes in dom/{workers,events,media,canvas}, r=smaug
dom/canvas/CanvasRenderingContext2D.h
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLFramebuffer.cpp
dom/events/AsyncEventDispatcher.h
dom/events/JSEventHandler.h
dom/events/TextComposition.h
dom/gamepad/Gamepad.cpp
dom/media/MediaData.h
dom/media/MediaResource.h
dom/media/MediaStreamGraph.h
dom/media/StreamBuffer.h
dom/media/webrtc/MediaEngine.h
dom/workers/WorkerPrivate.cpp
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -902,16 +902,17 @@ protected:
 
   bool CheckSizeForSkiaGL(mozilla::gfx::IntSize size);
 
   // state stack handling
   class ContextState {
   public:
     ContextState() : textAlign(TextAlign::START),
                      textBaseline(TextBaseline::ALPHABETIC),
+                     shadowColor(0),
                      lineWidth(1.0f),
                      miterLimit(10.0f),
                      globalAlpha(1.0f),
                      shadowBlur(0.0),
                      dashOffset(0.0f),
                      op(mozilla::gfx::CompositionOp::OP_OVER),
                      fillRule(mozilla::gfx::FillRule::FILL_WINDING),
                      lineCap(mozilla::gfx::CapStyle::BUTT),
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -96,43 +96,64 @@ WebGLContextOptions::WebGLContextOptions
 }
 
 
 /*static*/ const uint32_t WebGLContext::kMinMaxColorAttachments = 4;
 /*static*/ const uint32_t WebGLContext::kMinMaxDrawBuffers = 4;
 
 WebGLContext::WebGLContext()
     : WebGLContextUnchecked(nullptr)
+    , mBufferFetchingIsVerified(false)
+    , mBufferFetchingHasPerVertex(false)
+    , mMaxFetchedVertices(0)
+    , mMaxFetchedInstances(0)
     , mBypassShaderValidation(false)
     , mGLMaxSamples(1)
     , mNeedsFakeNoAlpha(false)
     , mNeedsFakeNoDepth(false)
     , mNeedsFakeNoStencil(false)
 {
     mGeneration = 0;
     mInvalidated = false;
     mCapturedFrameInvalidated = false;
     mShouldPresent = true;
     mResetLayer = true;
     mOptionsFrozen = false;
+    mMinCapability = false;
+    mDisableExtensions = false;
+    mIsMesa = false;
+    mEmitContextLostErrorOnce = false;
+    mWebGLError = 0;
+    mUnderlyingGLError = 0;
 
     mActiveTexture = 0;
 
     mVertexAttrib0Vector[0] = 0;
     mVertexAttrib0Vector[1] = 0;
     mVertexAttrib0Vector[2] = 0;
     mVertexAttrib0Vector[3] = 1;
     mFakeVertexAttrib0BufferObjectVector[0] = 0;
     mFakeVertexAttrib0BufferObjectVector[1] = 0;
     mFakeVertexAttrib0BufferObjectVector[2] = 0;
     mFakeVertexAttrib0BufferObjectVector[3] = 1;
     mFakeVertexAttrib0BufferObjectSize = 0;
     mFakeVertexAttrib0BufferObject = 0;
     mFakeVertexAttrib0BufferStatus = WebGLVertexAttrib0Status::Default;
 
+    mStencilRefFront = 0;
+    mStencilRefBack = 0;
+    mStencilValueMaskFront = 0;
+    mStencilValueMaskBack = 0;
+    mStencilWriteMaskFront = 0;
+    mStencilWriteMaskBack = 0;
+    mDepthWriteMask = 0;
+    mStencilClearValue = 0;
+    mDepthClearValue = 0;
+    mContextLostErrorSet = false;
+
     mViewportX = 0;
     mViewportY = 0;
     mViewportWidth = 0;
     mViewportHeight = 0;
 
     mDitherEnabled = 1;
     mRasterizerDiscardEnabled = 0; // OpenGL ES 3.0 spec p244
     mScissorTestEnabled = 0;
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -15,16 +15,18 @@
 #include "WebGLTexture.h"
 
 namespace mozilla {
 
 WebGLFBAttachPoint::WebGLFBAttachPoint(WebGLFramebuffer* fb, GLenum attachmentPoint)
     : mFB(fb)
     , mAttachmentPoint(attachmentPoint)
     , mTexImageTarget(LOCAL_GL_NONE)
+    , mTexImageLayer(0)
+    , mTexImageLevel(0)
 { }
 
 WebGLFBAttachPoint::~WebGLFBAttachPoint()
 {
     MOZ_ASSERT(!mRenderbufferPtr);
     MOZ_ASSERT(!mTexturePtr);
 }
 
--- a/dom/events/AsyncEventDispatcher.h
+++ b/dom/events/AsyncEventDispatcher.h
@@ -50,16 +50,17 @@ public:
     , mBubbles(aBubbles)
     , mOnlyChromeDispatch(false)
   {
   }
 
   AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent)
     : mTarget(aTarget)
     , mEvent(aEvent)
+    , mBubbles(false)
     , mOnlyChromeDispatch(false)
   {
   }
 
   AsyncEventDispatcher(dom::EventTarget* aTarget, WidgetEvent& aEvent);
 
   NS_IMETHOD Run() override;
   nsresult PostDOMEvent();
--- a/dom/events/JSEventHandler.h
+++ b/dom/events/JSEventHandler.h
@@ -32,26 +32,29 @@ public:
   };
 
   TypedEventHandler()
     : mBits(0)
   {
   }
 
   explicit TypedEventHandler(dom::EventHandlerNonNull* aHandler)
+    : mBits(0)
   {
     Assign(aHandler, eNormal);
   }
 
   explicit TypedEventHandler(dom::OnErrorEventHandlerNonNull* aHandler)
+    : mBits(0)
   {
     Assign(aHandler, eOnError);
   }
 
   explicit TypedEventHandler(dom::OnBeforeUnloadEventHandlerNonNull* aHandler)
+    : mBits(0)
   {
     Assign(aHandler, eOnBeforeUnload);
   }
 
   TypedEventHandler(const TypedEventHandler& aOther)
   {
     if (aOther.HasEventHandler()) {
       // Have to make sure we take our own ref
--- a/dom/events/TextComposition.h
+++ b/dom/events/TextComposition.h
@@ -251,17 +251,30 @@ private:
   // Allow control characters appear in composition string.
   // When this is false, control characters except
   // CHARACTER TABULATION (horizontal tab) are removed from
   // both composition string and data attribute of compositionupdate
   // and compositionend events.
   bool mAllowControlCharacters;
 
   // Hide the default constructor and copy constructor.
-  TextComposition() {}
+  TextComposition()
+    : mPresContext(nullptr)
+    , mNativeContext(nullptr)
+    , mCompositionStartOffset(0)
+    , mCompositionTargetOffset(0)
+    , mIsSynthesizedForTests(false)
+    , mIsComposing(false)
+    , mIsEditorHandlingEvent(false)
+    , mIsRequestingCommit(false)
+    , mIsRequestingCancel(false)
+    , mRequestedToCommitOrCancel(false)
+    , mWasNativeCompositionEndEventDiscarded(false)
+    , mAllowControlCharacters(false)
+  {}
   TextComposition(const TextComposition& aOther);
 
   /**
    * GetEditor() returns nsIEditor pointer of mEditorWeak.
    */
   already_AddRefed<nsIEditor> GetEditor() const;
 
   /**
@@ -379,17 +392,17 @@ private:
 
   private:
     RefPtr<TextComposition> mTextComposition;
     nsCOMPtr<nsINode> mEventTarget;
     nsString mData;
     EventMessage mEventMessage;
     bool mIsSynthesizedEvent;
 
-    CompositionEventDispatcher() {};
+    CompositionEventDispatcher() : mIsSynthesizedEvent(false) {};
   };
 
   /**
    * DispatchCompositionEventRunnable() dispatches a composition event to the
    * content.  Be aware, if you use this method, nsPresShellEventCB isn't used.
    * That means that nsIFrame::HandleEvent() is never called.
    * WARNING: The instance which is managed by IMEStateManager may be
    *          destroyed by this method call.
--- a/dom/gamepad/Gamepad.cpp
+++ b/dom/gamepad/Gamepad.cpp
@@ -41,17 +41,18 @@ Gamepad::Gamepad(nsISupports* aParent,
                  GamepadMappingType aMapping,
                  uint32_t aNumButtons, uint32_t aNumAxes)
   : mParent(aParent),
     mID(aID),
     mIndex(aIndex),
     mMapping(aMapping),
     mConnected(true),
     mButtons(aNumButtons),
-    mAxes(aNumAxes)
+    mAxes(aNumAxes),
+    mTimestamp(0)
 {
   for (unsigned i = 0; i < aNumButtons; i++) {
     mButtons.InsertElementAt(i, new GamepadButton(mParent));
   }
   mAxes.InsertElementsAt(0, aNumAxes, 0.0f);
   UpdateTimestamp();
 }
 
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -313,17 +313,17 @@ public:
 
 protected:
   ~VideoData();
 };
 
 class CryptoTrack
 {
 public:
-  CryptoTrack() : mValid(false) {}
+  CryptoTrack() : mValid(false), mMode(0), mIVSize(0) {}
   bool mValid;
   int32_t mMode;
   int32_t mIVSize;
   nsTArray<uint8_t> mKeyId;
 };
 
 class CryptoSample : public CryptoTrack
 {
--- a/dom/media/MediaResource.h
+++ b/dom/media/MediaResource.h
@@ -57,17 +57,22 @@ class MediaChannelStatistics;
  * kind of average of the data passing through over the time the
  * channel is active.
  *
  * All methods take "now" as a parameter so the user of this class can
  * control the timeline used.
  */
 class MediaChannelStatistics {
 public:
-  MediaChannelStatistics() { Reset(); }
+  MediaChannelStatistics()
+    : mAccumulatedBytes(0)
+    , mIsStarted(false)
+  {
+    Reset();
+  }
 
   explicit MediaChannelStatistics(MediaChannelStatistics * aCopyFrom)
   {
     MOZ_ASSERT(aCopyFrom);
     mAccumulatedBytes = aCopyFrom->mAccumulatedBytes;
     mAccumulatedTime = aCopyFrom->mAccumulatedTime;
     mLastStartTime = aCopyFrom->mLastStartTime;
     mIsStarted = aCopyFrom->mIsStarted;
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -1039,17 +1039,17 @@ private:
  * This stream processes zero or more input streams in parallel to produce
  * its output. The details of how the output is produced are handled by
  * subclasses overriding the ProcessInput method.
  */
 class ProcessedMediaStream : public MediaStream
 {
 public:
   explicit ProcessedMediaStream(DOMMediaStream* aWrapper)
-    : MediaStream(aWrapper), mAutofinish(false)
+    : MediaStream(aWrapper), mAutofinish(false), mCycleMarker(0)
   {}
 
   // Control API.
   /**
    * Allocates a new input port attached to source aStream.
    * This stream can be removed by calling MediaInputPort::Remove().
    * The input port is tied to aTrackID in the source stream.
    * aTrackID can be set to TRACK_ANY to automatically forward all tracks from
--- a/dom/media/StreamBuffer.h
+++ b/dom/media/StreamBuffer.h
@@ -155,17 +155,18 @@ public:
       return aA->GetID() == aB->GetID();
     }
     bool LessThan(Track* aA, Track* aB) const {
       return aA->GetID() < aB->GetID();
     }
   };
 
   StreamBuffer()
-    : mTracksKnownTime(0)
+    : mGraphRate(0)
+    , mTracksKnownTime(0)
     , mForgottenTime(0)
     , mTracksDirty(false)
 #ifdef DEBUG
     , mGraphRateIsSet(false)
 #endif
   {
     MOZ_COUNT_CTOR(StreamBuffer);
   }
--- a/dom/media/webrtc/MediaEngine.h
+++ b/dom/media/webrtc/MediaEngine.h
@@ -205,16 +205,24 @@ protected:
   bool mHasFakeTracks;
 };
 
 /**
  * Video source and friends.
  */
 class MediaEnginePrefs {
 public:
+  MediaEnginePrefs()
+    : mWidth(0)
+    , mHeight(0)
+    , mFPS(0)
+    , mMinFPS(0)
+    , mFreq(0)
+  {}
+
   int32_t mWidth;
   int32_t mHeight;
   int32_t mFPS;
   int32_t mMinFPS;
   int32_t mFreq; // for test tones (fake:true)
 
   // mWidth and/or mHeight may be zero (=adaptive default), so use functions.
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -2203,17 +2203,18 @@ WorkerPrivateParent<Derived>::WorkerPriv
   mCondVar(mMutex, "WorkerPrivateParent CondVar"),
   mMemoryReportCondVar(mMutex, "WorkerPrivateParent Memory Report CondVar"),
   mParent(aParent), mScriptURL(aScriptURL),
   mWorkerName(aWorkerName), mLoadingWorkerScript(false),
   mBusyCount(0), mParentStatus(Pending), mParentFrozen(false),
   mParentSuspended(false), mIsChromeWorker(aIsChromeWorker),
   mMainThreadObjectsForgotten(false), mWorkerType(aWorkerType),
   mCreationTimeStamp(TimeStamp::Now()),
-  mCreationTimeHighRes((double)PR_Now() / PR_USEC_PER_MSEC)
+  mCreationTimeHighRes((double)PR_Now() / PR_USEC_PER_MSEC),
+  mNowBaseTimeHighRes(0)
 {
   MOZ_ASSERT_IF(!IsDedicatedWorker(),
                 !aWorkerName.IsVoid() && NS_IsMainThread());
   MOZ_ASSERT_IF(IsDedicatedWorker(), aWorkerName.IsEmpty());
 
   if (aLoadInfo.mWindow) {
     AssertIsOnMainThread();
     MOZ_ASSERT(aLoadInfo.mWindow->IsInnerWindow(),
@@ -3920,16 +3921,17 @@ WorkerPrivate::WorkerPrivate(JSContext* 
   , mCloseHandlerFinished(false)
   , mPendingEventQueueClearing(false)
   , mMemoryReporterRunning(false)
   , mBlockedForMemoryReporter(false)
   , mCancelAllPendingRunnables(false)
   , mPeriodicGCTimerRunning(false)
   , mIdleGCTimerRunning(false)
   , mWorkerScriptExecutedSuccessfully(false)
+  , mOnLine(false)
 {
   MOZ_ASSERT_IF(!IsDedicatedWorker(), !aWorkerName.IsVoid());
   MOZ_ASSERT_IF(IsDedicatedWorker(), aWorkerName.IsEmpty());
 
   if (aParent) {
     aParent->AssertIsOnWorkerThread();
     aParent->GetAllPreferences(mPreferences);
     mOnLine = aParent->OnLine();