diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index ca10ffb8b1d..6ea5ffa9183 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -618,6 +618,9 @@ nsGlobalWindow::CleanUp() mOpener = nsnull; // Forces Release if (mContext) { +#ifdef DEBUG + nsCycleCollector_DEBUG_shouldBeFreed(mContext); +#endif mContext = nsnull; // Forces Release } mChromeEventHandler = nsnull; // Forces Release @@ -1818,10 +1821,11 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell) mScriptContexts[st_ndx] = nsnull; } } - mContext = nsnull; // we nuked it above also #ifdef DEBUG + nsCycleCollector_DEBUG_shouldBeFreed(mContext); nsCycleCollector_DEBUG_shouldBeFreed(static_cast(this)); #endif + mContext = nsnull; // we nuked it above also } mDocShell = aDocShell; // Weak Reference diff --git a/dom/src/base/nsJSEnvironment.cpp b/dom/src/base/nsJSEnvironment.cpp index 8da3e9cbcdd..4ab94b066bc 100644 --- a/dom/src/base/nsJSEnvironment.cpp +++ b/dom/src/base/nsJSEnvironment.cpp @@ -996,6 +996,9 @@ nsJSContext::nsJSContext(JSRuntime *aRuntime) : mGCOnDestruction(PR_TRUE) nsJSContext::~nsJSContext() { +#ifdef DEBUG + nsCycleCollector_DEBUG_wasFreed(static_cast(this)); +#endif NS_PRECONDITION(!mTerminations, "Shouldn't have termination funcs by now"); // Cope with JS_NewContext failure in ctor (XXXbe move NewContext to Init?)