Bug 820067 - Check that mTiming is still around in case the beforeunload handler killed it. r=smaug,bz
authorBenjamin Peterson <benjamin@python.org>
Mon, 10 Dec 2012 15:34:01 -0500
changeset 124609 ab7c54f6472f52cf91e81320c5f404cccbcbe526
parent 124608 af0f5575a15324cb76c3d9c77b7f5ac18c5da8f6
child 124610 4dfe323a663d507e2ee9e22479ce08f6f47807f8
child 126458 4eb4b9205aa4b7d61f95fd682c836aaf15d9af1e
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, bz
bugs820067
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 820067 - Check that mTiming is still around in case the beforeunload handler killed it. r=smaug,bz
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8977,34 +8977,34 @@ nsDocShell::InternalLoad(nsIURI * aURI,
     // XXXbz mTiming should know what channel it's for, so we don't
     // need this hackery.  Note that this is still broken in cases
     // when we're loading something that's not javascript: and the
     // beforeunload handler denies the load.  That will screw up
     // timing for the next load!
     if (!bIsJavascript) {
         MaybeInitTiming();
     }
-    bool timeBeforeUnload = mTiming && aFileName.IsVoid();
-    if (timeBeforeUnload) {
+    bool timeBeforeUnload = aFileName.IsVoid();
+    if (mTiming && timeBeforeUnload) {
       mTiming->NotifyBeforeUnload();
     }
     // Check if the page doesn't want to be unloaded. The javascript:
     // protocol handler deals with this for javascript: URLs.
     if (!bIsJavascript && aFileName.IsVoid() && mContentViewer) {
         bool okToUnload;
         rv = mContentViewer->PermitUnload(false, &okToUnload);
 
         if (NS_SUCCEEDED(rv) && !okToUnload) {
             // The user chose not to unload the page, interrupt the
             // load.
             return NS_OK;
         }
     }
 
-    if (timeBeforeUnload) {
+    if (mTiming && timeBeforeUnload) {
       mTiming->NotifyUnloadAccepted(mCurrentURI);
     }
 
     // Check for saving the presentation here, before calling Stop().
     // This is necessary so that we can catch any pending requests.
     // Since the new request has not been created yet, we pass null for the
     // new request parameter.
     // Also pass nullptr for the document, since it doesn't affect the return