Bug 840263 - Make sure to notify the right navigation timing about page load. r=hsivonen, a=lsblakk
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 20 Feb 2013 20:15:21 +0200
changeset 132207 65ce204912f1fd871e1a96defed61bc91c3fcca2
parent 132206 3429bb5e8954cd44b047e541604227c8e0f6c22e
child 132208 fde0a9170a83e49bbb4535a3b836c5ca8741eea8
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen, lsblakk
bugs840263
milestone21.0a2
Bug 840263 - Make sure to notify the right navigation timing about page load. r=hsivonen, a=lsblakk
layout/base/nsDocumentViewer.cpp
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -984,17 +984,17 @@ nsDocumentViewer::LoadComplete(nsresult 
     nsCOMPtr<nsIPresShell> shell = mPresShell;
     shell->FlushPendingNotifications(Flush_Layout);
   }
 
   nsresult rv = NS_OK;
   NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
 
   // First, get the window from the document...
-  nsPIDOMWindow *window = mDocument->GetWindow();
+  nsCOMPtr<nsPIDOMWindow> window = mDocument->GetWindow();
 
   mLoaded = true;
 
   // Now, fire either an OnLoad or OnError event to the document...
   bool restoring = false;
   // XXXbz imagelib kills off the document load for a full-page image with
   // NS_ERROR_PARSED_DATA_CACHED if it's in the cache.  So we want to treat
   // that one as a success code; otherwise whether we fire onload for the image
@@ -1020,19 +1020,20 @@ nsDocumentViewer::LoadComplete(nsresult 
                  mDocument->GetReadyStateEnum() ==
                    nsIDocument::READYSTATE_INTERACTIVE ||
                  // test_stricttransportsecurity.html has old-style
                  // docshell-generated about:blank docs reach this code!
                  (mDocument->GetReadyStateEnum() ==
                     nsIDocument::READYSTATE_UNINITIALIZED &&
                   NS_IsAboutBlank(mDocument->GetDocumentURI())),
                  "Bad readystate");
+      nsCOMPtr<nsIDocument> d = mDocument;
       mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
 
-      nsRefPtr<nsDOMNavigationTiming> timing(mDocument->GetNavigationTiming());
+      nsRefPtr<nsDOMNavigationTiming> timing(d->GetNavigationTiming());
       if (timing) {
         timing->NotifyLoadEventStart();
       }
       nsEventDispatcher::Dispatch(window, mPresContext, &event, nullptr,
                                   &status);
       if (timing) {
         timing->NotifyLoadEventEnd();
       }