Fixing bug 261998. Don't fire the beforeunload event when loading a link to an anchor in the current document. r+sr=bzbarsky@mit.edu
This commit is contained in:
@@ -5228,19 +5228,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.
|
||||
@@ -5353,6 +5340,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
|
||||
|
||||
Reference in New Issue
Block a user