Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug
☠☠ backed out by 85ce52fac76c ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 12 Jan 2016 13:57:37 +0000
changeset 279584 d6b0ffe1a7b3a14cd40882c9fbcf644b0984ade8
parent 279583 138c4e6a9b450aa0bba51642d01bffbba6461930
child 279585 6d08ab04a77c8c7bdef78224e43968cd33bd8ade
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs1231378
milestone46.0a1
Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug
memory/volatile/VolatileBuffer.h
netwerk/dns/ChildDNSService.cpp
netwerk/dns/DNS.cpp
netwerk/dns/DNSRequestParent.cpp
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsIDNService.cpp
storage/mozStorageBindingParams.cpp
storage/mozStorageRow.h
storage/mozStorageStatementData.h
storage/mozStorageStatementParams.cpp
tools/profiler/public/GeckoProfilerImpl.h
uriloader/prefetch/OfflineCacheUpdateChild.cpp
uriloader/prefetch/nsOfflineCacheUpdate.cpp
widget/BasicEvents.h
widget/MouseEvents.h
widget/ScreenProxy.cpp
widget/TextEvents.h
widget/nsFilePickerProxy.cpp
widget/xremoteclient/XRemoteClient.cpp
--- a/memory/volatile/VolatileBuffer.h
+++ b/memory/volatile/VolatileBuffer.h
@@ -83,17 +83,21 @@ private:
 #elif defined(XP_WIN)
   bool mHeap;
   bool mFirstLock;
 #endif
 };
 
 class VolatileBufferPtr_base {
 public:
-  explicit VolatileBufferPtr_base(VolatileBuffer* vbuf) : mVBuf(vbuf) {
+  explicit VolatileBufferPtr_base(VolatileBuffer* vbuf)
+    : mVBuf(vbuf)
+    , mMapping(nullptr)
+    , mPurged(false)
+  {
     Lock();
   }
 
   ~VolatileBufferPtr_base() {
     Unlock();
   }
 
   bool WasBufferPurged() const {
--- a/netwerk/dns/ChildDNSService.cpp
+++ b/netwerk/dns/ChildDNSService.cpp
@@ -38,16 +38,17 @@ ChildDNSService* ChildDNSService::GetSin
 NS_IMPL_ISUPPORTS(ChildDNSService,
                   nsIDNSService,
                   nsPIDNSService,
                   nsIObserver)
 
 ChildDNSService::ChildDNSService()
   : mFirstTime(true)
   , mOffline(false)
+  , mDisablePrefetch(false)
   , mPendingRequestsLock("DNSPendingRequestsLock")
 {
   MOZ_ASSERT(IsNeckoChild());
 }
 
 ChildDNSService::~ChildDNSService()
 {
 
--- a/netwerk/dns/DNS.cpp
+++ b/netwerk/dns/DNS.cpp
@@ -256,16 +256,19 @@ NetAddrElement::NetAddrElement(const Net
 }
 
 NetAddrElement::~NetAddrElement()
 {
 }
 
 AddrInfo::AddrInfo(const char *host, const PRAddrInfo *prAddrInfo,
                    bool disableIPv4, bool filterNameCollision, const char *cname)
+  : mHostName(nullptr)
+  , mCanonicalName(nullptr)
+  , ttl(NO_TTL_DATA)
 {
   MOZ_ASSERT(prAddrInfo, "Cannot construct AddrInfo with a null prAddrInfo pointer!");
   const uint32_t nameCollisionAddr = htonl(0x7f003535); // 127.0.53.53
 
   Init(host, cname);
   PRNetAddr tmpAddr;
   void *iter = nullptr;
   do {
@@ -276,16 +279,19 @@ AddrInfo::AddrInfo(const char *host, con
     if (addIt) {
         NetAddrElement *addrElement = new NetAddrElement(&tmpAddr);
         mAddresses.insertBack(addrElement);
     }
   } while (iter);
 }
 
 AddrInfo::AddrInfo(const char *host, const char *cname)
+  : mHostName(nullptr)
+  , mCanonicalName(nullptr)
+  , ttl(NO_TTL_DATA)
 {
   Init(host, cname);
 }
 
 AddrInfo::~AddrInfo()
 {
   NetAddrElement *addrElement;
   while ((addrElement = mAddresses.popLast())) {
--- a/netwerk/dns/DNSRequestParent.cpp
+++ b/netwerk/dns/DNSRequestParent.cpp
@@ -15,17 +15,18 @@
 #include "mozilla/unused.h"
 
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace net {
 
 DNSRequestParent::DNSRequestParent()
-  : mIPCClosed(false)
+  : mFlags(0)
+  , mIPCClosed(false)
 {
 
 }
 
 DNSRequestParent::~DNSRequestParent()
 {
 
 }
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -475,18 +475,22 @@ public:
 private:
     nsCString                                 mHostname;
 };
 
 //-----------------------------------------------------------------------------
 
 nsDNSService::nsDNSService()
     : mLock("nsDNSServer.mLock")
+    , mDisableIPv6(false)
+    , mDisablePrefetch(false)
     , mFirstTime(true)
     , mOffline(false)
+    , mNotifyResolution(false)
+    , mOfflineLocalhost(false)
 {
 }
 
 nsDNSService::~nsDNSService()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsDNSService, nsIDNSService, nsPIDNSService, nsIObserver,
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -127,16 +127,19 @@ void nsIDNService::prefsChanged(nsIPrefB
       mRestrictionProfile = eHighlyRestrictiveProfile;
     } else {
       mRestrictionProfile = eASCIIOnlyProfile;
     }
   }
 }
 
 nsIDNService::nsIDNService()
+  : mNamePrepHandle(0)
+  , mShowPunycode(false)
+  , mIDNUseWhitelist(false)
 {
 #ifdef IDNA2008
   uint32_t IDNAOptions = UIDNA_CHECK_BIDI | UIDNA_CHECK_CONTEXTJ;
   if (!kIDNA2008_TransitionalProcessing) {
     IDNAOptions |= UIDNA_NONTRANSITIONAL_TO_UNICODE;
   }
   UErrorCode errorCode = U_ZERO_ERROR;
   mIDNA = uidna_openUTS46(IDNAOptions, &errorCode);
--- a/storage/mozStorageBindingParams.cpp
+++ b/storage/mozStorageBindingParams.cpp
@@ -103,16 +103,17 @@ sqlite3_T_blob(BindingColumnData aData,
 ////////////////////////////////////////////////////////////////////////////////
 //// BindingParams
 
 BindingParams::BindingParams(mozIStorageBindingParamsArray *aOwningArray,
                              Statement *aOwningStatement)
 : mLocked(false)
 , mOwningArray(aOwningArray)
 , mOwningStatement(aOwningStatement)
+, mParamCount(0)
 {
   (void)mOwningStatement->GetParameterCount(&mParamCount);
   mParameters.SetCapacity(mParamCount);
 }
 
 BindingParams::BindingParams(mozIStorageBindingParamsArray *aOwningArray)
 : mLocked(false)
 , mOwningArray(aOwningArray)
--- a/storage/mozStorageRow.h
+++ b/storage/mozStorageRow.h
@@ -19,16 +19,18 @@ namespace storage {
 
 class Row final : public mozIStorageRow
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEROW
   NS_DECL_MOZISTORAGEVALUEARRAY
 
+  Row() : mNumCols(0) {}
+
   /**
    * Initializes the object with the given statement.  Copies the values from
    * the statement.
    *
    * @param aStatement
    *        The sqlite statement to pull results from.
    */
   nsresult initialize(sqlite3_stmt *aStatement);
--- a/storage/mozStorageStatementData.h
+++ b/storage/mozStorageStatementData.h
@@ -39,16 +39,17 @@ public:
   StatementData(const StatementData &aSource)
   : mStatement(aSource.mStatement)
   , mParamsArray(aSource.mParamsArray)
   , mStatementOwner(aSource.mStatementOwner)
   {
     NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
   }
   StatementData()
+  : mStatement(nullptr)
   {
   }
   ~StatementData()
   {
     // We need to ensure that mParamsArray is released on the main thread,
     // as the binding arguments may be XPConnect values, which are safe
     // to release only on the main thread.
     nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
--- a/storage/mozStorageStatementParams.cpp
+++ b/storage/mozStorageStatementParams.cpp
@@ -16,17 +16,18 @@
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// StatementParams
 
 StatementParams::StatementParams(mozIStorageStatement *aStatement) :
-    mStatement(aStatement)
+    mStatement(aStatement),
+    mParamCount(0)
 {
   NS_ASSERTION(mStatement != nullptr, "mStatement is null");
   (void)mStatement->GetParameterCount(&mParamCount);
 }
 
 NS_IMPL_ISUPPORTS(
   StatementParams,
   mozIStorageStatementParams,
--- a/tools/profiler/public/GeckoProfilerImpl.h
+++ b/tools/profiler/public/GeckoProfilerImpl.h
@@ -427,16 +427,17 @@ private:
 };
 
 static const int SAMPLER_MAX_STRING = 128;
 class MOZ_STACK_CLASS SamplerStackFramePrintfRAII {
 public:
   // we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.
   SamplerStackFramePrintfRAII(const char *aInfo,
     js::ProfileEntry::Category aCategory, uint32_t line, const char *aFormat, ...)
+    : mHandle(nullptr)
   {
     if (profiler_is_active() && !profiler_in_privacy_mode()) {
       va_list args;
       va_start(args, aFormat);
       char buff[SAMPLER_MAX_STRING];
 
       // We have to use seperate printf's because we're using
       // the vargs.
--- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp
+++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp
@@ -71,16 +71,17 @@ NS_IMPL_RELEASE(OfflineCacheUpdateChild)
 
 //-----------------------------------------------------------------------------
 // OfflineCacheUpdateChild <public>
 //-----------------------------------------------------------------------------
 
 OfflineCacheUpdateChild::OfflineCacheUpdateChild(nsIDOMWindow* aWindow)
     : mState(STATE_UNINITIALIZED)
     , mIsUpgrade(false)
+    , mSucceeded(false)
     , mAppID(NECKO_NO_APP_ID)
     , mInBrowser(false)
     , mWindow(aWindow)
     , mByteProgress(0)
 {
 }
 
 OfflineCacheUpdateChild::~OfflineCacheUpdateChild()
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -682,16 +682,17 @@ nsOfflineManifestItem::nsOfflineManifest
                                              nsIPrincipal* aLoadingPrincipal,
                                              nsIApplicationCache *aApplicationCache,
                                              nsIApplicationCache *aPreviousApplicationCache)
     : nsOfflineCacheUpdateItem(aURI, aReferrerURI, aLoadingPrincipal,
                                aApplicationCache, aPreviousApplicationCache,
                                nsIApplicationCache::ITEM_MANIFEST)
     , mParserState(PARSE_INIT)
     , mNeedsUpdate(true)
+    , mStrictFileOriginPolicy(false)
     , mManifestHashInitialized(false)
 {
     ReadStrictFileOriginPolicyPref();
 }
 
 nsOfflineManifestItem::~nsOfflineManifestItem()
 {
 }
@@ -1163,16 +1164,17 @@ nsOfflineCacheUpdate::nsOfflineCacheUpda
     , mSucceeded(true)
     , mObsolete(false)
     , mAppID(NECKO_NO_APP_ID)
     , mInBrowser(false)
     , mItemsInProgress(0)
     , mRescheduleCount(0)
     , mPinnedEntryRetriesCount(0)
     , mPinned(false)
+    , mByteProgress(0)
 {
 }
 
 nsOfflineCacheUpdate::~nsOfflineCacheUpdate()
 {
     LOG(("nsOfflineCacheUpdate::~nsOfflineCacheUpdate [%p]", this));
 }
 
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -185,16 +185,17 @@ protected:
     MOZ_COUNT_CTOR(WidgetEvent);
     mFlags.Clear();
     mFlags.mIsTrusted = aIsTrusted;
     mFlags.mCancelable = true;
     mFlags.mBubbles = true;
   }
 
   WidgetEvent()
+    : time(0)
   {
     MOZ_COUNT_CTOR(WidgetEvent);
   }
 
 public:
   WidgetEvent(bool aIsTrusted, EventMessage aMessage)
     : mClass(eBasicEventClass)
     , mMessage(aMessage)
@@ -565,16 +566,17 @@ protected:
   WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
                    EventClassID aEventClassID)
     : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
     , modifiers(0)
   {
   }
 
   WidgetInputEvent()
+    : modifiers(0)
   {
   }
 
 public:
   virtual WidgetInputEvent* AsInputEvent() override { return this; }
 
   WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
     : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eInputEventClass)
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -69,16 +69,21 @@ public:
 class WidgetMouseEventBase : public WidgetInputEvent
 {
 private:
   friend class dom::PBrowserParent;
   friend class dom::PBrowserChild;
 
 protected:
   WidgetMouseEventBase()
+    : button(0)
+    , buttons(0)
+    , pressure(0)
+    , hitCluster(false)
+    , inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
   {
   }
 
   WidgetMouseEventBase(bool aIsTrusted, EventMessage aMessage,
                        nsIWidget* aWidget, EventClassID aEventClassID)
     : WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
     , button(0)
     , buttons(0)
@@ -190,16 +195,19 @@ public:
   enum exitType
   {
     eChild,
     eTopLevel
   };
 
 protected:
   WidgetMouseEvent()
+    : acceptActivation(false)
+    , ignoreRootScrollFrame(false)
+    , clickCount(0)
   {
   }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
                    EventClassID aEventClassID, reasonType aReason)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
@@ -311,16 +319,18 @@ public:
 
 class WidgetDragEvent : public WidgetMouseEvent
 {
 private:
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
 protected:
   WidgetDragEvent()
+    : userCancelled(false)
+    , mDefaultPreventedOnContent(false)
   {
   }
 public:
   virtual WidgetDragEvent* AsDragEvent() override { return this; }
 
   WidgetDragEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
     : WidgetMouseEvent(aIsTrusted, aMessage, aWidget, eDragEventClass, eReal)
     , userCancelled(false)
@@ -368,16 +378,18 @@ public:
  * DOMMouseScroll and MozMousePixelScroll event.  These events are NOT hanbled
  * by ESM even if widget dispatches them.  Use new WidgetWheelEvent instead.
  ******************************************************************************/
 
 class WidgetMouseScrollEvent : public WidgetMouseEventBase
 {
 private:
   WidgetMouseScrollEvent()
+    : delta(0)
+    , isHorizontal(false)
   {
   }
 
 public:
   virtual WidgetMouseScrollEvent* AsMouseScrollEvent() override
   {
     return this;
   }
@@ -431,16 +443,30 @@ public:
 
 class WidgetWheelEvent : public WidgetMouseEventBase
 {
 private:
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
 
   WidgetWheelEvent()
+    : deltaX(0.0)
+    , deltaY(0.0)
+    , deltaZ(0.0)
+    , deltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
+    , customizedByUserPrefs(false)
+    , isMomentum(false)
+    , mIsNoLineOrPageDelta(false)
+    , lineOrPageDeltaX(0)
+    , lineOrPageDeltaY(0)
+    , scrollType(SCROLL_DEFAULT)
+    , overflowDeltaX(0.0)
+    , overflowDeltaY(0.0)
+    , mViewPortIsOverscrolled(false)
+    , mCanTriggerSwipe(false)
   {
   }
 
 public:
   virtual WidgetWheelEvent* AsWheelEvent() override { return this; }
 
   WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass)
@@ -600,16 +626,19 @@ public:
  ******************************************************************************/
 
 class WidgetPointerEvent : public WidgetMouseEvent
 {
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
 
   WidgetPointerEvent()
+    : width(0)
+    , height(0)
+    , isPrimary(true)
   {
   }
 
 public:
   virtual WidgetPointerEvent* AsPointerEvent() override { return this; }
 
   WidgetPointerEvent(bool aIsTrusted, EventMessage aMsg, nsIWidget* w)
     : WidgetMouseEvent(aIsTrusted, aMsg, w, ePointerEventClass, eReal)
--- a/widget/ScreenProxy.cpp
+++ b/widget/ScreenProxy.cpp
@@ -15,17 +15,21 @@
 namespace mozilla {
 namespace widget {
 
 using namespace mozilla::dom;
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 ScreenProxy::ScreenProxy(nsScreenManagerProxy* aScreenManager, ScreenDetails aDetails)
-  : mScreenManager(aScreenManager)
+  : mContentsScaleFactor(0)
+  , mScreenManager(aScreenManager)
+  , mId(0)
+  , mPixelDepth(0)
+  , mColorDepth(0)
   , mCacheValid(false)
   , mCacheWillInvalidate(false)
 {
   PopulateByDetails(aDetails);
 }
 
 NS_IMETHODIMP
 ScreenProxy::GetId(uint32_t *outId)
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -77,16 +77,30 @@ struct AlternativeCharCode
 class WidgetKeyboardEvent : public WidgetInputEvent
 {
 private:
   friend class dom::PBrowserParent;
   friend class dom::PBrowserChild;
 
 protected:
   WidgetKeyboardEvent()
+    : keyCode(0)
+    , charCode(0)
+    , location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
+    , isChar(false)
+    , mIsRepeat(false)
+    , mIsComposing(false)
+    , mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
+    , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
+    , mNativeKeyEvent(nullptr)
+    , mUniqueId(0)
+#ifdef XP_MACOSX
+    , mNativeKeyCode(0)
+    , mNativeModifierFlags(0)
+#endif
   {
   }
 
 public:
   virtual WidgetKeyboardEvent* AsKeyboardEvent() override { return this; }
 
   WidgetKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
                       nsIWidget* aWidget,
@@ -465,16 +479,19 @@ public:
 
 class WidgetQueryContentEvent : public WidgetGUIEvent
 {
 private:
   friend class dom::PBrowserParent;
   friend class dom::PBrowserChild;
 
   WidgetQueryContentEvent()
+    : mSucceeded(false)
+    , mUseNativeLineBreak(true)
+    , mWithFontRanges(false)
   {
     MOZ_CRASH("WidgetQueryContentEvent is created without proper arguments");
   }
 
 public:
   virtual WidgetQueryContentEvent* AsQueryContentEvent() override
   {
     return this;
@@ -645,16 +662,17 @@ private:
   friend class mozilla::dom::PBrowserChild;
 
   WidgetSelectionEvent()
     : mOffset(0)
     , mLength(0)
     , mReversed(false)
     , mExpandToClusterBoundary(true)
     , mSucceeded(false)
+    , mUseNativeLineBreak(true)
   {
   }
 
 public:
   virtual WidgetSelectionEvent* AsSelectionEvent() override
   {
     return this;
   }
--- a/widget/nsFilePickerProxy.cpp
+++ b/widget/nsFilePickerProxy.cpp
@@ -11,16 +11,17 @@
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/ipc/BlobChild.h"
 
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS(nsFilePickerProxy, nsIFilePicker)
 
 nsFilePickerProxy::nsFilePickerProxy()
+  : mSelectedType(0)
 {
 }
 
 nsFilePickerProxy::~nsFilePickerProxy()
 {
 }
 
 NS_IMETHODIMP
--- a/widget/xremoteclient/XRemoteClient.cpp
+++ b/widget/xremoteclient/XRemoteClient.cpp
@@ -57,19 +57,22 @@ static int (*sOldHandler)(Display *, XEr
 static bool sGotBadWindow;
 
 XRemoteClient::XRemoteClient()
 {
   mDisplay = 0;
   mInitialized = false;
   mMozVersionAtom = 0;
   mMozLockAtom = 0;
+  mMozCommandLineAtom = 0;
   mMozResponseAtom = 0;
   mMozWMStateAtom = 0;
   mMozUserAtom = 0;
+  mMozProfileAtom = 0;
+  mMozProgramAtom = 0;
   mLockData = 0;
   if (!sRemoteLm)
     sRemoteLm = PR_NewLogModule("XRemoteClient");
   MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::XRemoteClient"));
 }
 
 XRemoteClient::~XRemoteClient()
 {