From 39ad2edb6d8005607189380508aa6dac1c88013f Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Tue, 12 Jan 2016 18:16:59 +0000 Subject: [PATCH] summary: Bug 1231378 - part 5 - Fix uninitialized members of classes in dom/{workers,events,media,canvas}, r=smaug --- dom/canvas/CanvasRenderingContext2D.h | 1 + dom/canvas/WebGLContext.cpp | 21 +++++++++++++++++++++ dom/canvas/WebGLFramebuffer.cpp | 2 ++ dom/events/AsyncEventDispatcher.h | 1 + dom/events/JSEventHandler.h | 3 +++ dom/events/TextComposition.h | 17 +++++++++++++++-- dom/gamepad/Gamepad.cpp | 3 ++- dom/media/MediaData.h | 2 +- dom/media/MediaResource.h | 7 ++++++- dom/media/MediaStreamGraph.h | 2 +- dom/media/StreamBuffer.h | 3 ++- dom/media/webrtc/MediaEngine.h | 8 ++++++++ dom/power/PowerManagerService.h | 3 ++- dom/workers/WorkerPrivate.cpp | 1 + modules/libjar/nsJARChannel.cpp | 2 +- 15 files changed, 67 insertions(+), 9 deletions(-) diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index 04c3bd89048..8395de55134 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -907,6 +907,7 @@ protected: public: ContextState() : textAlign(TextAlign::START), textBaseline(TextBaseline::ALPHABETIC), + shadowColor(0), lineWidth(1.0f), miterLimit(10.0f), globalAlpha(1.0f), diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index aa2fcad5ab3..2d1989def2d 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -101,6 +101,10 @@ WebGLContextOptions::WebGLContextOptions() WebGLContext::WebGLContext() : WebGLContextUnchecked(nullptr) + , mBufferFetchingIsVerified(false) + , mBufferFetchingHasPerVertex(false) + , mMaxFetchedVertices(0) + , mMaxFetchedInstances(0) , mBypassShaderValidation(false) , mGLMaxSamples(1) , mNeedsFakeNoAlpha(false) @@ -113,6 +117,12 @@ WebGLContext::WebGLContext() mShouldPresent = true; mResetLayer = true; mOptionsFrozen = false; + mMinCapability = false; + mDisableExtensions = false; + mIsMesa = false; + mEmitContextLostErrorOnce = false; + mWebGLError = 0; + mUnderlyingGLError = 0; mActiveTexture = 0; @@ -128,6 +138,17 @@ WebGLContext::WebGLContext() 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; diff --git a/dom/canvas/WebGLFramebuffer.cpp b/dom/canvas/WebGLFramebuffer.cpp index a61c47bb7f8..ad7d7b25856 100644 --- a/dom/canvas/WebGLFramebuffer.cpp +++ b/dom/canvas/WebGLFramebuffer.cpp @@ -20,6 +20,8 @@ WebGLFBAttachPoint::WebGLFBAttachPoint(WebGLFramebuffer* fb, GLenum attachmentPo : mFB(fb) , mAttachmentPoint(attachmentPoint) , mTexImageTarget(LOCAL_GL_NONE) + , mTexImageLayer(0) + , mTexImageLevel(0) { } WebGLFBAttachPoint::~WebGLFBAttachPoint() diff --git a/dom/events/AsyncEventDispatcher.h b/dom/events/AsyncEventDispatcher.h index af7c202aeec..5754876b896 100644 --- a/dom/events/AsyncEventDispatcher.h +++ b/dom/events/AsyncEventDispatcher.h @@ -55,6 +55,7 @@ public: AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent) : mTarget(aTarget) , mEvent(aEvent) + , mBubbles(false) , mOnlyChromeDispatch(false) { } diff --git a/dom/events/JSEventHandler.h b/dom/events/JSEventHandler.h index 9234f986d37..be2ecf9a46c 100644 --- a/dom/events/JSEventHandler.h +++ b/dom/events/JSEventHandler.h @@ -37,16 +37,19 @@ public: } 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); } diff --git a/dom/events/TextComposition.h b/dom/events/TextComposition.h index 6ddcde24801..f99da8ef09a 100644 --- a/dom/events/TextComposition.h +++ b/dom/events/TextComposition.h @@ -256,7 +256,20 @@ private: 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); /** @@ -384,7 +397,7 @@ private: EventMessage mEventMessage; bool mIsSynthesizedEvent; - CompositionEventDispatcher() {}; + CompositionEventDispatcher() : mIsSynthesizedEvent(false) {}; }; /** diff --git a/dom/gamepad/Gamepad.cpp b/dom/gamepad/Gamepad.cpp index 6fca4268676..81d3feee7e9 100644 --- a/dom/gamepad/Gamepad.cpp +++ b/dom/gamepad/Gamepad.cpp @@ -46,7 +46,8 @@ Gamepad::Gamepad(nsISupports* aParent, 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)); diff --git a/dom/media/MediaData.h b/dom/media/MediaData.h index 50f67418494..09e9673cc08 100644 --- a/dom/media/MediaData.h +++ b/dom/media/MediaData.h @@ -318,7 +318,7 @@ protected: class CryptoTrack { public: - CryptoTrack() : mValid(false) {} + CryptoTrack() : mValid(false), mMode(0), mIVSize(0) {} bool mValid; int32_t mMode; int32_t mIVSize; diff --git a/dom/media/MediaResource.h b/dom/media/MediaResource.h index 0fa94b3bd28..cd2f4e6a146 100644 --- a/dom/media/MediaResource.h +++ b/dom/media/MediaResource.h @@ -62,7 +62,12 @@ class MediaChannelStatistics; */ class MediaChannelStatistics { public: - MediaChannelStatistics() { Reset(); } + MediaChannelStatistics() + : mAccumulatedBytes(0) + , mIsStarted(false) + { + Reset(); + } explicit MediaChannelStatistics(MediaChannelStatistics * aCopyFrom) { diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index 724ff0c24ba..0ea27ff2b00 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -1044,7 +1044,7 @@ class ProcessedMediaStream : public MediaStream { public: explicit ProcessedMediaStream(DOMMediaStream* aWrapper) - : MediaStream(aWrapper), mAutofinish(false) + : MediaStream(aWrapper), mAutofinish(false), mCycleMarker(0) {} // Control API. diff --git a/dom/media/StreamBuffer.h b/dom/media/StreamBuffer.h index 8b06235f4b1..3112aa6332b 100644 --- a/dom/media/StreamBuffer.h +++ b/dom/media/StreamBuffer.h @@ -160,7 +160,8 @@ public: }; StreamBuffer() - : mTracksKnownTime(0) + : mGraphRate(0) + , mTracksKnownTime(0) , mForgottenTime(0) , mTracksDirty(false) #ifdef DEBUG diff --git a/dom/media/webrtc/MediaEngine.h b/dom/media/webrtc/MediaEngine.h index 72fe6c1a084..6d9a4956c73 100644 --- a/dom/media/webrtc/MediaEngine.h +++ b/dom/media/webrtc/MediaEngine.h @@ -210,6 +210,14 @@ protected: */ class MediaEnginePrefs { public: + MediaEnginePrefs() + : mWidth(0) + , mHeight(0) + , mFPS(0) + , mMinFPS(0) + , mFreq(0) + {} + int32_t mWidth; int32_t mHeight; int32_t mFPS; diff --git a/dom/power/PowerManagerService.h b/dom/power/PowerManagerService.h index d346cc45085..ebea4d1160f 100644 --- a/dom/power/PowerManagerService.h +++ b/dom/power/PowerManagerService.h @@ -10,6 +10,7 @@ #include "nsDataHashtable.h" #include "nsHashKeys.h" #include "nsTArray.h" +#include "nsIDOMWakeLockListener.h" #include "nsIPowerManagerService.h" #include "mozilla/Observer.h" #include "Types.h" @@ -73,7 +74,7 @@ private: static StaticRefPtr sSingleton; - nsTArray > mWakeLockListeners; + nsTArray> mWakeLockListeners; int32_t mWatchdogTimeoutSecs; }; diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 0c7f927a85e..0511acab351 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -3925,6 +3925,7 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx, , mPeriodicGCTimerRunning(false) , mIdleGCTimerRunning(false) , mWorkerScriptExecutedSuccessfully(false) + , mOnLine(false) { MOZ_ASSERT_IF(!IsDedicatedWorker(), !aWorkerName.IsVoid()); MOZ_ASSERT_IF(IsDedicatedWorker(), aWorkerName.IsEmpty()); diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index e244e494ec4..4d548703f49 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -195,8 +195,8 @@ nsJARInputThunk::IsNonBlocking(bool *nonBlocking) nsJARChannel::nsJARChannel() : mOpened(false) - , mContentDisposition(0) , mAppURI(nullptr) + , mContentDisposition(0) , mContentLength(-1) , mLoadFlags(LOAD_NORMAL) , mStatus(NS_OK)