From a421fa5c8b975ac9c0e7178cbf43f87fa4b57771 Mon Sep 17 00:00:00 2001 From: "jst%mozilla.jstenback.com" Date: Wed, 13 Oct 2004 16:50:34 +0000 Subject: [PATCH] Fixing bug 261998. Don't fire beforeunload events when loading links to anchors in the current document. r+sr=bzbarsky@mit.edu, a=asa@mozilla.org git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_7_BRANCH@163657 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 89a9d6e84c3..3258261db73 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -5255,19 +5255,6 @@ nsDocShell::InternalLoad(nsIURI * aURI, return rv; } - // Check if the page doesn't want to be unloaded. The javascript: - // protocol handler deals with this for javascript: URLs. - if (!bIsJavascript && mContentViewer) { - PRBool okToUnload; - rv = mContentViewer->PermitUnload(&okToUnload); - - if (NS_SUCCEEDED(rv) && !okToUnload) { - // The user chose not to unload the page, interrupt the - // load. - return NS_OK; - } - } - // // Load is being targetted at this docshell so return an error if the // docshell is in the process of being destroyed. @@ -5380,6 +5367,19 @@ nsDocShell::InternalLoad(nsIURI * aURI, } } + // Check if the page doesn't want to be unloaded. The javascript: + // protocol handler deals with this for javascript: URLs. + if (!bIsJavascript && mContentViewer) { + PRBool okToUnload; + rv = mContentViewer->PermitUnload(&okToUnload); + + if (NS_SUCCEEDED(rv) && !okToUnload) { + // The user chose not to unload the page, interrupt the + // load. + return NS_OK; + } + } + // Don't stop current network activity for javascript: URL's since // they might not result in any data, and thus nothing should be // stopped in those cases. In the case where they do result in