Fixing bug 130265. Don't stop current network activity when loading javascript: URL's unless the URL results in data to parse. r=adamlock@netscape.com, sr=darin@netscape.com, a=asa@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@142481 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2003-05-15 01:23:26 +00:00
parent afcbfd7c43
commit 262beabfdd
3 changed files with 92 additions and 55 deletions

View File

@@ -4916,15 +4916,24 @@ nsDocShell::InternalLoad(nsIURI * aURI,
*aRequest = nsnull;
}
if (!aURI) {
return NS_ERROR_NULL_POINTER;
}
// wyciwyg urls can only be loaded through history. Any normal load of
// wyciwyg through docshell is illegal. Disallow such loads.
if (aURI && (aLoadType & LOAD_CMD_NORMAL)) {
if (aLoadType & LOAD_CMD_NORMAL) {
PRBool isWyciwyg = PR_FALSE;
rv = aURI->SchemeIs("wyciwyg", &isWyciwyg);
if ((isWyciwyg && NS_SUCCEEDED(rv)) || NS_FAILED(rv))
return NS_ERROR_FAILURE;
}
PRBool bIsJavascript = PR_FALSE;
if (NS_FAILED(aURI->SchemeIs("javascript", &bIsJavascript))) {
bIsJavascript = PR_FALSE;
}
//
// First, notify any nsIContentPolicy listeners about the document load.
// Only abort the load if a content policy listener explicitly vetos it!
@@ -4970,9 +4979,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// See bug #52182
//
if (mUseExternalProtocolHandler && aLoadType == LOAD_LINK) {
PRBool bIsJavascript = PR_FALSE;
aURI->SchemeIs("javascript", &bIsJavascript);
// don't do it for javascript urls!
if (!bIsJavascript &&
(name.EqualsIgnoreCase("_content") ||
@@ -5190,29 +5196,36 @@ nsDocShell::InternalLoad(nsIURI * aURI,
return NS_OK;
}
}
//
// Stop any current network activity.
// Also stop content if this is a zombie doc. otherwise
// the onload will be delayed by other loads initiated in the
// background by the first document that
// didn't fully load before the next load was initiated.
// If not a zombie, don't stop content until data
// starts arriving from the new URI...
nsCOMPtr<nsIContentViewer> zombieViewer;
if (mContentViewer) {
mContentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer));
// 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
// data, the javascript: URL channel takes care of stopping
// current network activity.
if (!bIsJavascript) {
// Stop any current network activity.
// Also stop content if this is a zombie doc. otherwise
// the onload will be delayed by other loads initiated in the
// background by the first document that
// didn't fully load before the next load was initiated.
// If not a zombie, don't stop content until data
// starts arriving from the new URI...
nsCOMPtr<nsIContentViewer> zombieViewer;
if (mContentViewer) {
mContentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer));
}
if (zombieViewer) {
rv = Stop(nsIWebNavigation::STOP_ALL);
} else {
rv = Stop(nsIWebNavigation::STOP_NETWORK);
}
if (NS_FAILED(rv))
return rv;
}
if (zombieViewer) {
rv = Stop(nsIWebNavigation::STOP_ALL);
} else {
rv = Stop(nsIWebNavigation::STOP_NETWORK);
}
if (NS_FAILED(rv))
return rv;
mLoadType = aLoadType;
// mLSHE should be assigned to aSHEntry, only after Stop() has
// been called.