diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index b86726572484..501f0dcbe4ef 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -162,7 +162,6 @@ #include "nsArray.h" #include "nsArrayUtils.h" -#include "nsAutoPtr.h" #include "nsCExternalHandlerService.h" #include "nsContentDLF.h" #include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...) @@ -6795,7 +6794,7 @@ void nsDocShell::ReattachEditorToWindow(nsISHEntry* aSHEntry) { return; } - mEditorData = aSHEntry->ForgetEditorData(); + mEditorData = WrapUnique(aSHEntry->ForgetEditorData()); if (mEditorData) { #ifdef DEBUG nsresult rv = @@ -6824,7 +6823,7 @@ void nsDocShell::DetachEditorFromWindow() { MOZ_ASSERT(!mIsBeingDestroyed || !mOSHE->HasDetachedEditor(), "We should not set the editor data again once after we " "detached the editor data during destroying this docshell"); - mOSHE->SetEditorData(mEditorData.forget()); + mOSHE->SetEditorData(mEditorData.release()); } else { mEditorData = nullptr; } @@ -7316,13 +7315,13 @@ nsresult nsDocShell::RestoreFromHistory() { // Hack to keep nsDocShellEditorData alive across the // SetContentViewer(nullptr) call below. - nsAutoPtr data(mLSHE->ForgetEditorData()); + UniquePtr data(mLSHE->ForgetEditorData()); // Now remove it from the cached presentation. mLSHE->SetContentViewer(nullptr); mEODForCurrentDocument = false; - mLSHE->SetEditorData(data.forget()); + mLSHE->SetEditorData(data.release()); #ifdef DEBUG { @@ -11827,7 +11826,7 @@ nsresult nsDocShell::EnsureEditorData() { // we're shutting down, or we already have a detached editor data // stored in the session history. We should only have one editordata // per docshell. - mEditorData = new nsDocShellEditorData(this); + mEditorData = MakeUnique(this); } return mEditorData ? NS_OK : NS_ERROR_NOT_AVAILABLE; diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index a090314ff321..164a272578b2 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -1159,7 +1159,7 @@ class nsDocShell final : public nsDocLoader, nsRevocableEventPtr mRestorePresentationEvent; // Editor data, if this document is designMode or contentEditable. - nsAutoPtr mEditorData; + mozilla::UniquePtr mEditorData; // Secure browser UI object nsCOMPtr mSecurityUI; diff --git a/docshell/shistory/SHEntryChild.cpp b/docshell/shistory/SHEntryChild.cpp index a15563cb2b68..6fcd3d549c78 100644 --- a/docshell/shistory/SHEntryChild.cpp +++ b/docshell/shistory/SHEntryChild.cpp @@ -893,14 +893,14 @@ NS_IMETHODIMP_(void) SHEntryChild::SyncPresentationState() { mShared->SyncPresentationState(); } nsDocShellEditorData* SHEntryChild::ForgetEditorData() { - return mShared->mEditorData.forget(); + return mShared->mEditorData.release(); } void SHEntryChild::SetEditorData(nsDocShellEditorData* aData) { NS_ASSERTION(!(aData && mShared->mEditorData), "We're going to overwrite an owning ref!"); if (mShared->mEditorData != aData) { - mShared->mEditorData = aData; + mShared->mEditorData = WrapUnique(aData); } } diff --git a/docshell/shistory/nsSHEntry.cpp b/docshell/shistory/nsSHEntry.cpp index 0ebc444ad55b..b19dc32bac51 100644 --- a/docshell/shistory/nsSHEntry.cpp +++ b/docshell/shistory/nsSHEntry.cpp @@ -1144,14 +1144,14 @@ nsLegacySHEntry::SyncPresentationState() { nsDocShellEditorData* nsLegacySHEntry::ForgetEditorData() { // XXX jlebar Check how this is used. - return GetState()->mEditorData.forget(); + return GetState()->mEditorData.release(); } void nsLegacySHEntry::SetEditorData(nsDocShellEditorData* aData) { NS_ASSERTION(!(aData && GetState()->mEditorData), "We're going to overwrite an owning ref!"); if (GetState()->mEditorData != aData) { - GetState()->mEditorData = aData; + GetState()->mEditorData = mozilla::WrapUnique(aData); } } diff --git a/docshell/shistory/nsSHEntryShared.h b/docshell/shistory/nsSHEntryShared.h index 8c1e3103e65e..ca46d43016c5 100644 --- a/docshell/shistory/nsSHEntryShared.h +++ b/docshell/shistory/nsSHEntryShared.h @@ -7,7 +7,6 @@ #ifndef nsSHEntryShared_h__ #define nsSHEntryShared_h__ -#include "nsAutoPtr.h" #include "nsCOMArray.h" #include "nsCOMPtr.h" #include "nsExpirationTracker.h" @@ -18,6 +17,7 @@ #include "nsStubMutationObserver.h" #include "mozilla/Attributes.h" +#include "mozilla/UniquePtr.h" class nsSHEntry; class nsISHEntry; @@ -122,7 +122,7 @@ class SHEntrySharedChildState { // FIXME Move to parent? nsCOMPtr mRefreshURIList; nsExpirationState mExpirationState; - nsAutoPtr mEditorData; + UniquePtr mEditorData; // FIXME Move to parent? bool mSaveLayoutState;