diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 669b0c446cf5..07cd90b1664e 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -375,6 +375,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement, nsStyledElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPrototype, nsXULPrototypeElement) + { + nsXULSlots* slots = static_cast(tmp->GetExistingSlots()); + if (slots) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader"); + nsISupports *frameLoader = + static_cast(slots->mFrameLoader); + cb.NoteXPCOMChild(frameLoader); + } + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(nsXULElement, nsStyledElement) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 63626abaf4c0..88c37ee79097 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -7054,6 +7054,11 @@ nsDocShell::RestoreFromHistory() mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull); viewer->SetPreviousViewer(mContentViewer); } + if (mOSHE && (!mContentViewer || !mSavingOldViewer)) { + // We don't plan to save a viewer in mOSHE; tell it to drop + // any other state it's holding. + mOSHE->SyncPresentationState(); + } // Order the mContentViewer setup just like Embed does. mContentViewer = nsnull; @@ -7671,9 +7676,14 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull); aNewViewer->SetPreviousViewer(mContentViewer); - - mContentViewer = nsnull; } + if (mOSHE && (!mContentViewer || !mSavingOldViewer)) { + // We don't plan to save a viewer in mOSHE; tell it to drop + // any other state it's holding. + mOSHE->SyncPresentationState(); + } + + mContentViewer = nsnull; // Now that we're about to switch documents, forget all of our children. // Note that we cached them as needed up in CaptureState above. diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index 86379440b04d..a0eee6fda259 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -763,6 +763,7 @@ nsSHEntry::DropPresentationState() mViewerBounds.SetRect(0, 0, 0, 0); mChildShells.Clear(); mRefreshURIList = nsnull; + mEditorData = nsnull; } void diff --git a/editor/libeditor/html/TypeInState.cpp b/editor/libeditor/html/TypeInState.cpp index 5e76e66784e7..acca9635bea6 100644 --- a/editor/libeditor/html/TypeInState.cpp +++ b/editor/libeditor/html/TypeInState.cpp @@ -44,7 +44,13 @@ * XPCOM cruft *******************************************************************/ -NS_IMPL_ISUPPORTS1(TypeInState, nsISelectionListener) +NS_IMPL_CYCLE_COLLECTION_1(TypeInState, mLastSelectionContainer) +NS_IMPL_CYCLE_COLLECTING_ADDREF(TypeInState) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TypeInState) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TypeInState) + NS_INTERFACE_MAP_ENTRY(nsISelectionListener) + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END /******************************************************************** * public methods diff --git a/editor/libeditor/html/TypeInState.h b/editor/libeditor/html/TypeInState.h index 424f6ea0f128..184a4aa3bc96 100644 --- a/editor/libeditor/html/TypeInState.h +++ b/editor/libeditor/html/TypeInState.h @@ -45,6 +45,7 @@ #include "nsEditProperty.h" #include "nsString.h" #include "nsTArray.h" +#include "nsCycleCollectionParticipant.h" struct PropItem { @@ -61,7 +62,8 @@ class TypeInState : public nsISelectionListener { public: - NS_DECL_ISUPPORTS + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS(TypeInState) TypeInState(); void Reset(); diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 3ce49c6676c4..cf06530bf771 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -230,10 +230,57 @@ nsHTMLEditor::Shutdown() NS_IF_RELEASE(sRangeHelper); } +NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLEditor) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTypeInState) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTextServices) + + tmp->HideResizers(); + + tmp->HideGrabber(); + + tmp->HideInlineTableEditingUI(); +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTypeInState) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTextServices) + + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopLeftHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopRightHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLeftHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRightHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomLeftHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomRightHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mActivatedHandle) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizingShadow) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizingInfo) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizedObject) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMouseMotionListenerP) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSelectionListenerP) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizeEventListenerP) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(objectResizeEventListeners) + + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAbsolutelyPositionedObject) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mGrabber) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPositioningShadow) + + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInlineEditedCell) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddColumnBeforeButton) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRemoveColumnButton) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddColumnAfterButton) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddRowBeforeButton) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRemoveRowButton) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddRowAfterButton) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + NS_IMPL_ADDREF_INHERITED(nsHTMLEditor, nsEditor) NS_IMPL_RELEASE_INHERITED(nsHTMLEditor, nsEditor) -NS_INTERFACE_MAP_BEGIN(nsHTMLEditor) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHTMLEditor) NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor) NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor_MOZILLA_2_0_BRANCH) NS_INTERFACE_MAP_ENTRY(nsIHTMLObjectResizer) diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h index 628556011258..75242bd80481 100644 --- a/editor/libeditor/html/nsHTMLEditor.h +++ b/editor/libeditor/html/nsHTMLEditor.h @@ -141,6 +141,7 @@ public: //NOTE macro used is for classes that inherit from // another class. Only the base class should use NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor) nsHTMLEditor();