Fixing bug 392532. Infinite recursion crash when getting scroll chrome flags off of a window at the wrong point in time. r+sr=bzbarsky@mit.edu, a=vladimir@pobox.com
git-svn-id: svn://10.0.0.236/trunk@239184 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -304,6 +304,9 @@ nsDocShell::nsDocShell():
|
||||
mEditorData(nsnull),
|
||||
mTreeOwner(nsnull),
|
||||
mChromeEventHandler(nsnull)
|
||||
#ifdef DEBUG
|
||||
, mInEnsureScriptEnv(PR_FALSE)
|
||||
#endif
|
||||
{
|
||||
if (gDocShellCount++ == 0) {
|
||||
NS_ASSERTION(sURIFixup == nsnull,
|
||||
@@ -8670,6 +8673,16 @@ nsDocShell::EnsureScriptEnvironment()
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(!mInEnsureScriptEnv,
|
||||
"Infinite loop! Calling EnsureScriptEnvironment() from "
|
||||
"within EnsureScriptEnvironment()!");
|
||||
|
||||
// Yeah, this isn't re-entrant safe, but that's ok since if we
|
||||
// re-enter this method, we'll infinitely loop...
|
||||
mInEnsureScriptEnv = PR_TRUE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
||||
do_GetService(kDOMScriptObjectFactoryCID);
|
||||
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
|
||||
@@ -8700,6 +8713,11 @@ nsDocShell::EnsureScriptEnvironment()
|
||||
nsresult rv;
|
||||
rv = mScriptGlobal->EnsureScriptEnvironment(nsIProgrammingLanguage::JAVASCRIPT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
mInEnsureScriptEnv = PR_FALSE;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user