From 09a857de063c035fe720461e27705e87b2cb74a1 Mon Sep 17 00:00:00 2001 From: "vidur%netscape.com" Date: Wed, 2 Feb 2000 23:40:22 +0000 Subject: [PATCH] Fix for bug 24306. The DocumentViewer now cleans up dangling webshell references in the PresContext. nsGenericElement::TriggerLink deals with a nonexistent handler (it might have been deleted already as part of event processing). r=buster, joki git-svn-id: svn://10.0.0.236/trunk@59566 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 5 +++++ mozilla/content/base/src/nsGenericElement.cpp | 5 ++--- mozilla/layout/base/nsDocumentViewer.cpp | 5 +++++ mozilla/layout/base/src/nsDocumentViewer.cpp | 5 +++++ mozilla/layout/base/src/nsGenericElement.cpp | 5 ++--- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 89cbf496c6f..83c40c4afa2 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl() mDocument->SetScriptGlobalObject(nsnull); } + if (mPresContext) { + mPresContext->SetContainer(nsnull); + mPresContext->SetLinkHandler(nsnull); + } + if (mDeviceContext) mDeviceContext->FlushFontCache(); diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 133820dc3a3..8697d1552a7 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -1275,9 +1275,8 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext, { nsCOMPtr handler; nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler)); - if (NS_FAILED(rv)) return rv; - if (!handler) return NS_ERROR_UNEXPECTED; // this can happen in editor windows - + if (NS_FAILED(rv) || (nsnull == handler)) return rv; + // Resolve url to an absolute url nsAutoString absURLSpec; if (nsnull != aBaseURL) { diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 89cbf496c6f..83c40c4afa2 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl() mDocument->SetScriptGlobalObject(nsnull); } + if (mPresContext) { + mPresContext->SetContainer(nsnull); + mPresContext->SetLinkHandler(nsnull); + } + if (mDeviceContext) mDeviceContext->FlushFontCache(); diff --git a/mozilla/layout/base/src/nsDocumentViewer.cpp b/mozilla/layout/base/src/nsDocumentViewer.cpp index 89cbf496c6f..83c40c4afa2 100644 --- a/mozilla/layout/base/src/nsDocumentViewer.cpp +++ b/mozilla/layout/base/src/nsDocumentViewer.cpp @@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl() mDocument->SetScriptGlobalObject(nsnull); } + if (mPresContext) { + mPresContext->SetContainer(nsnull); + mPresContext->SetLinkHandler(nsnull); + } + if (mDeviceContext) mDeviceContext->FlushFontCache(); diff --git a/mozilla/layout/base/src/nsGenericElement.cpp b/mozilla/layout/base/src/nsGenericElement.cpp index 133820dc3a3..8697d1552a7 100644 --- a/mozilla/layout/base/src/nsGenericElement.cpp +++ b/mozilla/layout/base/src/nsGenericElement.cpp @@ -1275,9 +1275,8 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext, { nsCOMPtr handler; nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler)); - if (NS_FAILED(rv)) return rv; - if (!handler) return NS_ERROR_UNEXPECTED; // this can happen in editor windows - + if (NS_FAILED(rv) || (nsnull == handler)) return rv; + // Resolve url to an absolute url nsAutoString absURLSpec; if (nsnull != aBaseURL) {