merge backout

This commit is contained in:
Makoto Kato 2009-05-16 00:40:54 +09:00
commit 226ffe4a61
5 changed files with 19 additions and 4 deletions

View File

@ -265,7 +265,6 @@ nsXBLDocGlobalObject::SetContext(nsIScriptContext *aScriptContext)
nsresult rv;
rv = aScriptContext->InitContext(nsnull);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Script Language's InitContext failed");
aScriptContext->SetGCOnDestruction(PR_FALSE);
aScriptContext->DidInitializeContext();
// and we set up our global manually
mScriptContext = aScriptContext;

View File

@ -693,7 +693,6 @@ nsXULPDGlobalObject::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScrip
void *script_glob = nsnull;
if (aScriptContext) {
aScriptContext->SetGCOnDestruction(PR_FALSE);
aScriptContext->DidInitializeContext();
script_glob = aScriptContext->GetNativeGlobal();
NS_ASSERTION(script_glob, "GetNativeGlobal returned NULL!");

View File

@ -278,6 +278,21 @@ nsDOMScriptObjectFactory::Observe(nsISupports *aSubject,
cache->Flush();
#endif
nsCOMPtr<nsIThreadJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
if (stack) {
JSContext *cx = nsnull;
stack->GetSafeJSContext(&cx);
if (cx) {
// Do one final GC to clean things up before shutdown.
::JS_GC(cx);
}
}
nsGlobalWindow::ShutDown();
nsDOMClassInfo::ShutDown();

View File

@ -582,7 +582,6 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
JSContextCallback cxCallback;
JSBool last;
rt = cx->runtime;
#ifdef JS_THREADSAFE
/*
* For API compatibility we allow to destroy contexts without a thread in
@ -592,9 +591,10 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
JS_ASSERT(cx->thread && CURRENT_THREAD_IS_ME(cx->thread));
if (!cx->thread)
JS_SetContextThread(cx);
#endif
rt = cx->runtime;
JS_ASSERT_IF(rt->gcRunning, cx->outstandingRequests == 0);
#endif
if (mode != JSDCM_NEW_FAILED) {
cxCallback = rt->cxCallback;

View File

@ -1674,6 +1674,8 @@ mozJSComponentLoader::Observe(nsISupports *subject, const char *topic,
mFastLoadTimer->Cancel();
}
JS_GC(mContext);
CloseFastLoad();
}
else if (!strcmp(topic, "xpcom-shutdown-loaders")) {