NS_ASSERTION(mPresShell, "Frame manager already shut down.");  nsCOMPtr<nsIPresContext> presContext; mPresShell->GetPresContext(getter_AddRefs(presContext));     mPresShell->SetIgnoreFrameDestruction(PR_TRUE);  mIsDestroyingFrames = PR_TRUE;  if (mRootFrame) { mRootFrame->Destroy(presContext); mRootFrame = nsnull; }  if (mPrimaryFrameMap.ops) { PL_DHashTableFinish(&mPrimaryFrameMap); mPrimaryFrameMap.ops = nsnull; } if (mPlaceholderMap.ops) { PL_DHashTableFinish(&mPlaceholderMap); mPlaceholderMap.ops = nsnull; } delete mUndisplayedMap; DestroyPropertyList(presContext);    nsresult rv = RevokePostedEvents(); NS_ASSERTION(NS_SUCCEEDED(rv), "RevokePostedEvents failed:  might crash");  mPresShell = nsnull;     return rv;
if (mDtorFunc) PL_DHashTableEnumerate(&mFrameValueMap, DestroyPropertyEnumerator, aPresContext);
FrameManager::Destroy(){  NS_ASSERTION(mPresShell, "Frame manager already shut down.");  nsCOMPtr<nsIPresContext> presContext;  mPresShell->GetPresContext(getter_AddRefs(presContext));    // Destroy the frame hierarchy. Don't destroy the property lists until after  // we've destroyed the frame hierarchy because some frames may expect to be  // able to retrieve their properties during destruction  mPresShell->SetIgnoreFrameDestruction(PR_TRUE);  mIsDestroyingFrames = PR_TRUE;  // This flag prevents GetPrimaryFrameFor from returning pointers to destroyed frames  if (mRootFrame) {    mRootFrame->Destroy(presContext);    mRootFrame = nsnull;  }    if (mPrimaryFrameMap.ops) {    PL_DHashTableFinish(&mPrimaryFrameMap);    mPrimaryFrameMap.ops = nsnull;  }  if (mPlaceholderMap.ops) {    PL_DHashTableFinish(&mPlaceholderMap);    mPlaceholderMap.ops = nsnull;  }  delete mUndisplayedMap;  DestroyPropertyList(presContext);  // If we're not going to be used anymore, we should revoke the  // pending |CantRenderReplacedElementEvent|s being sent to us.  nsresult rv = RevokePostedEvents();  NS_ASSERTION(NS_SUCCEEDED(rv), "RevokePostedEvents failed:  might crash");  mPresShell = nsnull; // mPresShell isn't valid anymore.  We                       // won't use it, either, but we check it                       // at the start of every function so that we'll                       // be OK when nsIPresShell is converted to IDL.  return rv;}