diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index e924d67ce91..0951005c2ab 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -2683,9 +2683,6 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) if (commandDispatcher) commandDispatcher->SetSuppressFocus(PR_FALSE); - if(mScriptContext) - mScriptContext->GC(); - mContentViewer = aNewViewer; nsCOMPtr widget; diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index a163c416d5e..5705e3ab33f 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -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 kungFuDeathGrip = mContext; kungFuDeathGrip->GC();