added deathgrip to survive window destruction during onload handler. part of fix for bug 19302. r:hyatt a:chofmann

This commit is contained in:
danm%netscape.com 1999-12-15 02:18:52 +00:00
parent 90f941f8fe
commit 6ad070506f
4 changed files with 20 additions and 0 deletions

View File

@ -3014,6 +3014,11 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
rv = channel->GetURI(getter_AddRefs(aURL));
if (NS_FAILED(rv)) return rv;
/* one of many safeguards that prevent death and destruction if
someone is so very very rude as to bring this window down
during this load handler. */
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
//if (!mProcessedEndDocumentLoad) {
if (loader == mDocLoader) {
mProcessedEndDocumentLoad = PR_TRUE;

View File

@ -960,6 +960,11 @@ void nsDocLoaderImpl::DocLoaderIsEmpty(nsresult aStatus)
{
if (mIsLoadingDocument) {
PRBool busy = PR_FALSE;
/* In the unimagineably rude circumstance that onload event handlers
triggered by this function actually kill the window ... ok, it's
not unimagineable; it's happened ... this deathgrip keeps this object
alive long enough to survive this function call. */
nsCOMPtr<nsIDocumentLoader> kungFuDeathGrip(this);
IsBusy(busy);
if (!busy) {

View File

@ -960,6 +960,11 @@ void nsDocLoaderImpl::DocLoaderIsEmpty(nsresult aStatus)
{
if (mIsLoadingDocument) {
PRBool busy = PR_FALSE;
/* In the unimagineably rude circumstance that onload event handlers
triggered by this function actually kill the window ... ok, it's
not unimagineable; it's happened ... this deathgrip keeps this object
alive long enough to survive this function call. */
nsCOMPtr<nsIDocumentLoader> kungFuDeathGrip(this);
IsBusy(busy);
if (!busy) {

View File

@ -3014,6 +3014,11 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
rv = channel->GetURI(getter_AddRefs(aURL));
if (NS_FAILED(rv)) return rv;
/* one of many safeguards that prevent death and destruction if
someone is so very very rude as to bring this window down
during this load handler. */
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
//if (!mProcessedEndDocumentLoad) {
if (loader == mDocLoader) {
mProcessedEndDocumentLoad = PR_TRUE;