Bug 1231378 - part 1 - Fix uninitialized members of classes in docshell/*, r=smaug
☠☠ backed out by 592fc90e655a ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 12 Jan 2016 13:54:52 +0000
changeset 320915 445a64a37945ec2b7fcc92be9b4df6ba060ff830
parent 320914 0af7319a6a4169d94453f8fcfd78384459c343db
child 320916 5f6a58676e874ffff75427abea117c20c7a90d5b
push id9315
push useratolfsen@mozilla.com
push dateTue, 12 Jan 2016 19:08:25 +0000
reviewerssmaug
bugs1231378
milestone46.0a1
Bug 1231378 - part 1 - Fix uninitialized members of classes in docshell/*, r=smaug
docshell/base/SerializedLoadContext.h
docshell/shistory/nsSHistory.cpp
--- a/docshell/base/SerializedLoadContext.h
+++ b/docshell/base/SerializedLoadContext.h
@@ -23,16 +23,21 @@ class nsIChannel;
 class nsIWebSocketChannel;
 
 namespace IPC {
 
 class SerializedLoadContext
 {
 public:
   SerializedLoadContext()
+    : mIsNotNull(false)
+    , mIsPrivateBitValid(false)
+    , mIsContent(false)
+    , mUsePrivateBrowsing(false)
+    , mUseRemoteTabs(false)
   {
     Init(nullptr);
   }
 
   explicit SerializedLoadContext(nsILoadContext* aLoadContext);
   explicit SerializedLoadContext(nsIChannel* aChannel);
   explicit SerializedLoadContext(nsIWebSocketChannel* aChannel);
 
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -228,16 +228,17 @@ EvictContentViewerForTransaction(nsISHTr
 }
 
 } // namespace
 
 nsSHistory::nsSHistory()
   : mIndex(-1)
   , mLength(0)
   , mRequestedIndex(-1)
+  , mRootDocShell(nullptr)
 {
   // Add this new SHistory object to the list
   PR_APPEND_LINK(this, &gSHistoryList);
 }
 
 nsSHistory::~nsSHistory()
 {
   // Remove this SHistory object from the list
@@ -999,30 +1000,30 @@ nsSHistory::EvictOutOfRangeWindowContent
 
 namespace {
 
 class TransactionAndDistance
 {
 public:
   TransactionAndDistance(nsISHTransaction* aTrans, uint32_t aDist)
     : mTransaction(aTrans)
+    , mLastTouched(0)
     , mDistance(aDist)
   {
     mViewer = GetContentViewerForTransaction(aTrans);
     NS_ASSERTION(mViewer, "Transaction should have a content viewer");
 
     nsCOMPtr<nsISHEntry> shentry;
     mTransaction->GetSHEntry(getter_AddRefs(shentry));
 
     nsCOMPtr<nsISHEntryInternal> shentryInternal = do_QueryInterface(shentry);
     if (shentryInternal) {
       shentryInternal->GetLastTouched(&mLastTouched);
     } else {
       NS_WARNING("Can't cast to nsISHEntryInternal?");
-      mLastTouched = 0;
     }
   }
 
   bool operator<(const TransactionAndDistance& aOther) const
   {
     // Compare distances first, and fall back to last-accessed times.
     if (aOther.mDistance != this->mDistance) {
       return this->mDistance < aOther.mDistance;