if (rootFrame && mHistoryState) {
nsCOMPtr<nsILayoutHistoryState> historyState = do_QueryReferent(mHistoryState); if (rootFrame && historyState) {
PresShell::EndLoad(nsIDocument *aDocument){  // Restore frame state for the root scroll frame  nsIFrame* rootFrame = nsnull;  GetRootFrame(&rootFrame);  if (rootFrame && mHistoryState) {    nsIFrame* scrollFrame = nsnull;    GetRootScrollFrame(mPresContext, rootFrame, &scrollFrame);    if (scrollFrame) {      mFrameManager->RestoreFrameStateFor(mPresContext, scrollFrame, mHistoryState, nsIStatefulFrame::eDocumentScrollState);    }  }#ifdef MOZ_PERF_METRICS  // Dump reflow, style resolution and frame construction times here.  MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::EndLoad(), this=%p\n", this));  MOZ_TIMER_STOP(mReflowWatch);  MOZ_TIMER_LOG(("Reflow time (this=%p): ", this));  MOZ_TIMER_PRINT(mReflowWatch);    MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::EndLoad(), this=%p\n", this));  MOZ_TIMER_STOP(mFrameCreationWatch);  MOZ_TIMER_LOG(("Frame construction plus style resolution time (this=%p): ", this));  MOZ_TIMER_PRINT(mFrameCreationWatch);  // Print style resolution stopwatch maintained by style set  MOZ_TIMER_DEBUGLOG(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));  CtlStyleWatch(kStyleWatchStop|kStyleWatchDisable, mStyleSet);  MOZ_TIMER_LOG(("Style resolution time (this=%p): ", this));  CtlStyleWatch(kStyleWatchPrint, mStyleSet);#endif    mDocumentLoading = PR_FALSE;  return NS_OK;}