Checkin in part of the fix for nsbeta3+ bug 42321. Avoid running JS_GC() many times per window open/close, once should be enough. Patch mostly done by alex@cendio.se, r=jst@netscape.com & vidur@netscape.com

This commit is contained in:
jst%netscape.com 2000-09-14 06:18:09 +00:00
parent 76a1bda8a7
commit 6fc361e1b1
2 changed files with 4 additions and 5 deletions

View File

@ -2683,9 +2683,6 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
if (commandDispatcher)
commandDispatcher->SetSuppressFocus(PR_FALSE);
if(mScriptContext)
mScriptContext->GC();
mContentViewer = aNewViewer;
nsCOMPtr<nsIWidget> widget;

View File

@ -269,7 +269,9 @@ NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument)
(JSObject *) mScriptObject);
if (mFirstDocumentLoad) {
mFirstDocumentLoad = PR_FALSE;
if (aDocument)
mFirstDocumentLoad = PR_FALSE;
mDocument = aDocument;
return NS_OK;
}
@ -321,7 +323,7 @@ NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument)
mDocument = nsnull; // Forces Release
}
if (mContext) {
if (mContext && aDocument) {
// Add an extra ref in case we release mContext during GC.
nsCOMPtr<nsIScriptContext> kungFuDeathGrip = mContext;
kungFuDeathGrip->GC();