From 97dcf454d569ada07cebc0392f6406b98b145e8e Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Wed, 21 Jul 2010 17:17:35 -0700 Subject: [PATCH] Bug 579782 - Deal with a null context when closing the window. r=jst --HG-- extra : rebase_source : d74e368d3a834fa47b6d912d35f0d9c6a0d60b7b --- dom/base/nsGlobalWindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 302dc0e43c0..162bd7276c5 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -2167,7 +2167,9 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell) mDoc = nsnull; } - mContext->ClearScope(mJSObject, PR_TRUE); + if (mContext) { + mContext->ClearScope(mJSObject, PR_TRUE); + } ClearControllers(); @@ -2181,9 +2183,11 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell) mArgumentsOrigin = nsnull; } - mContext->GC(); - mContext->FinalizeContext(); - mContext = nsnull; + if (mContext) { + mContext->GC(); + mContext->FinalizeContext(); + mContext = nsnull; + } #ifdef DEBUG nsCycleCollector_DEBUG_shouldBeFreed(mContext);