Docshell doesn't need to hold a pointer to the scriptcontext; the window does

it.  Bug 282807, r+sr=jst
This commit is contained in:
bzbarsky@mit.edu
2005-02-20 17:02:02 +00:00
parent 074b129a30
commit b4fc1cf29b
4 changed files with 18 additions and 19 deletions

View File

@@ -3405,10 +3405,6 @@ nsDocShell::Destroy()
mScriptGlobal->SetGlobalObjectOwner(nsnull);
mScriptGlobal = nsnull;
}
if (mScriptContext) {
mScriptContext->SetOwner(nsnull);
mScriptContext = nsnull;
}
mSessionHistory = nsnull;
SetTreeOwner(nsnull);
@@ -6959,7 +6955,7 @@ nsDocShell::GetRootScrollableView(nsIScrollableView ** aOutScrollView)
NS_IMETHODIMP
nsDocShell::EnsureScriptEnvironment()
{
if (mScriptContext)
if (mScriptGlobal)
return NS_OK;
if (mIsBeingDestroyed) {
@@ -6979,8 +6975,12 @@ nsDocShell::EnsureScriptEnvironment()
SetGlobalObjectOwner(NS_STATIC_CAST
(nsIScriptGlobalObjectOwner *, this));
factory->NewScriptContext(mScriptGlobal, getter_AddRefs(mScriptContext));
NS_ENSURE_TRUE(mScriptContext, NS_ERROR_FAILURE);
nsCOMPtr<nsIScriptContext> context;
factory->NewScriptContext(mScriptGlobal, getter_AddRefs(context));
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
// Note that mScriptGlobal has taken a reference to the script
// context, so we don't have to.
return NS_OK;
}