Bug 698656 - mParent pointer should be on nsSHEntry, not nsSHEntryShared. r=bz
authorJustin Lebar <justin.lebar@gmail.com>
Mon, 31 Oct 2011 22:33:24 -0400
changeset 79496 f3babd4e975f7cecf9e80a2e160d878ee8037ce7
parent 79495 faa9a3226feab24dceb0df1a755a1a39683dc21a
child 79497 470ed3885e3c65bf6a35ddc7e4f89e16cd6462eb
push id21408
push userkhuey@mozilla.com
push dateTue, 01 Nov 2011 14:32:20 +0000
treeherdermozilla-central@cd9add22f090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs698656
milestone10.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 698656 - mParent pointer should be on nsSHEntry, not nsSHEntryShared. r=bz Now with less bustage, I hope.
docshell/shistory/src/nsSHEntry.cpp
docshell/shistory/src/nsSHEntry.h
docshell/shistory/src/nsSHEntryShared.cpp
docshell/shistory/src/nsSHEntryShared.h
--- a/docshell/shistory/src/nsSHEntry.cpp
+++ b/docshell/shistory/src/nsSHEntry.cpp
@@ -61,31 +61,33 @@ static PRUint32 gEntryID = 0;
 //*****************************************************************************
 
 
 nsSHEntry::nsSHEntry()
   : mLoadType(0)
   , mID(gEntryID++)
   , mScrollPositionX(0)
   , mScrollPositionY(0)
+  , mParent(nsnull)
   , mURIWasModified(false)
 {
   mShared = new nsSHEntryShared();
 }
 
 nsSHEntry::nsSHEntry(const nsSHEntry &other)
   : mShared(other.mShared)
   , mURI(other.mURI)
   , mReferrerURI(other.mReferrerURI)
   , mTitle(other.mTitle)
   , mPostData(other.mPostData)
   , mLoadType(0)         // XXX why not copy?
   , mID(other.mID)
   , mScrollPositionX(0)  // XXX why not copy?
   , mScrollPositionY(0)  // XXX why not copy?
+  , mParent(other.mParent)
   , mURIWasModified(other.mURIWasModified)
   , mStateData(other.mStateData)
 {
 }
 
 static bool
 ClearParentPtr(nsISHEntry* aEntry, void* /* aData */)
 {
@@ -412,30 +414,30 @@ nsSHEntry::Clone(nsISHEntry ** aResult)
   NS_ADDREF(*aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::GetParent(nsISHEntry ** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
-  *aResult = mShared->mParent;
+  *aResult = mParent;
   NS_IF_ADDREF(*aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::SetParent(nsISHEntry * aParent)
 {
   /* parent not Addrefed on purpose to avoid cyclic reference
    * Null parent is OK
    *
    * XXX this method should not be scriptable if this is the case!!
    */
-  mShared->mParent = aParent;
+  mParent = aParent;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::SetWindowState(nsISupports *aState)
 {
   mShared->mWindowState = aState;
   return NS_OK;
--- a/docshell/shistory/src/nsSHEntry.h
+++ b/docshell/shistory/src/nsSHEntry.h
@@ -85,14 +85,15 @@ private:
   nsCOMPtr<nsIURI>         mURI;
   nsCOMPtr<nsIURI>         mReferrerURI;
   nsString                 mTitle;
   nsCOMPtr<nsIInputStream> mPostData;
   PRUint32                 mLoadType;
   PRUint32                 mID;
   PRInt32                  mScrollPositionX;
   PRInt32                  mScrollPositionY;
+  nsISHEntry*              mParent;
   nsCOMArray<nsISHEntry>   mChildren;
   bool                     mURIWasModified;
   nsCOMPtr<nsIStructuredCloneContainer> mStateData;
 };
 
 #endif /* nsSHEntry_h */
--- a/docshell/shistory/src/nsSHEntryShared.cpp
+++ b/docshell/shistory/src/nsSHEntryShared.cpp
@@ -88,17 +88,16 @@ void
 nsSHEntryShared::Shutdown()
 {
   delete gHistoryTracker;
   gHistoryTracker = nsnull;
 }
 
 nsSHEntryShared::nsSHEntryShared()
   : mDocShellID(0)
-  , mParent(nsnull)
   , mIsFrameNavigation(false)
   , mSaveLayoutState(true)
   , mSticky(true)
   , mDynamicallyCreated(false)
   , mLastTouched(0)
   , mID(gSHEntrySharedID++)
   , mExpired(false)
   , mViewerBounds(0, 0, 0, 0)
@@ -131,17 +130,16 @@ NS_IMPL_ISUPPORTS2(nsSHEntryShared, nsIB
 already_AddRefed<nsSHEntryShared>
 nsSHEntryShared::Duplicate(nsSHEntryShared *aEntry)
 {
   nsRefPtr<nsSHEntryShared> newEntry = new nsSHEntryShared();
 
   newEntry->mDocShellID = aEntry->mDocShellID;
   newEntry->mChildShells.AppendObjects(aEntry->mChildShells);
   newEntry->mOwner = aEntry->mOwner;
-  newEntry->mParent = aEntry->mParent;
   newEntry->mContentType.Assign(aEntry->mContentType);
   newEntry->mIsFrameNavigation = aEntry->mIsFrameNavigation;
   newEntry->mSaveLayoutState = aEntry->mSaveLayoutState;
   newEntry->mSticky = aEntry->mSticky;
   newEntry->mDynamicallyCreated = aEntry->mDynamicallyCreated;
   newEntry->mCacheKey = aEntry->mCacheKey;
   newEntry->mLastTouched = aEntry->mLastTouched;
 
--- a/docshell/shistory/src/nsSHEntryShared.h
+++ b/docshell/shistory/src/nsSHEntryShared.h
@@ -94,17 +94,16 @@ class nsSHEntryShared : public nsIBFCach
 
     // See nsISHEntry.idl for an explanation of these members.
 
     // These members are copied by nsSHEntryShared::Duplicate().  If you add a
     // member here, be sure to update the Duplicate() implementation.
     PRUint64                        mDocShellID;
     nsCOMArray<nsIDocShellTreeItem> mChildShells;
     nsCOMPtr<nsISupports>           mOwner;
-    nsISHEntry*                     mParent;
     nsCString                       mContentType;
     bool                            mIsFrameNavigation;
     bool                            mSaveLayoutState;
     bool                            mSticky;
     bool                            mDynamicallyCreated;
     nsCOMPtr<nsISupports>           mCacheKey;
     PRUint32                        mLastTouched;