r=norris,warren,radha. a=chofmann. Fix for bug 1646. Javascript: URLS were not getting loaded properly because the webshell was changing its notion of the current document (by setting mURL and mReferrer) too eagerly. Now, it does so only after the nsDocLoader::LoadDocument() in DoLoadURL() returns successfully.

This commit is contained in:
nisheeth%netscape.com 1999-11-04 22:09:46 +00:00
parent 0a89d40c78
commit 716e6e11a8
2 changed files with 20 additions and 20 deletions

View File

@ -1978,14 +1978,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
rv = aUri->GetSpec(getter_Copies(urlSpec));
if (NS_FAILED(rv)) return rv;
/* mURL is being set the value again so that calls to DoLoadURL() from Viewer
* will work right. This statement could go to Goto(), but that really is
* Vidur's call
*/
mURL = urlSpec;
mReferrer = aReferrer;
// If it's a normal reload that uses the cache, look at the destination anchor
// and see if it's an element within the current document
// We don't have a reload loadtype yet in necko. So, check for just history
@ -2092,8 +2084,7 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
/* WebShell was primarily passing the buck when it came to streamObserver.
* So, pass on the observer which is already a streamObserver to DocLoder.
*/
return mDocLoader->LoadDocument(aUri, // URL string
rv = mDocLoader->LoadDocument(aUri, // URL string
aCommand, // Command
this, // Container
aPostDataStream, // Post Data
@ -2101,6 +2092,15 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
aType, // reload type
aLocalIP, // load attributes.
aReferrer); // referrer
// Fix for bug 1646. Change the notion of current url and referrer only after
// the document load succeeds.
if (NS_SUCCEEDED(rv)) {
mURL = urlSpec;
mReferrer = aReferrer;
}
return rv;
}
NS_IMETHODIMP

View File

@ -1978,14 +1978,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
rv = aUri->GetSpec(getter_Copies(urlSpec));
if (NS_FAILED(rv)) return rv;
/* mURL is being set the value again so that calls to DoLoadURL() from Viewer
* will work right. This statement could go to Goto(), but that really is
* Vidur's call
*/
mURL = urlSpec;
mReferrer = aReferrer;
// If it's a normal reload that uses the cache, look at the destination anchor
// and see if it's an element within the current document
// We don't have a reload loadtype yet in necko. So, check for just history
@ -2092,8 +2084,7 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
/* WebShell was primarily passing the buck when it came to streamObserver.
* So, pass on the observer which is already a streamObserver to DocLoder.
*/
return mDocLoader->LoadDocument(aUri, // URL string
rv = mDocLoader->LoadDocument(aUri, // URL string
aCommand, // Command
this, // Container
aPostDataStream, // Post Data
@ -2101,6 +2092,15 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
aType, // reload type
aLocalIP, // load attributes.
aReferrer); // referrer
// Fix for bug 1646. Change the notion of current url and referrer only after
// the document load succeeds.
if (NS_SUCCEEDED(rv)) {
mURL = urlSpec;
mReferrer = aReferrer;
}
return rv;
}
NS_IMETHODIMP