Mark and handle collection of mPrototypeJSFunction just like mPrototypeJSObject is already handled. b=353704 r+sr=jst

This commit is contained in:
dbaron%dbaron.org 2006-09-23 08:08:03 +00:00
Родитель cd4afa2fb0
Коммит 5b317ad4a3
2 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -666,6 +666,12 @@ MarkScopeJSObjects(JSContext *cx, XPCWrappedNativeScope* scope, void *arg)
{
JS_MarkGCThing(cx, obj, "XPCWrappedNativeScope::mPrototypeJSObject", arg);
}
obj = scope->GetPrototypeJSFunction();
if(obj)
{
JS_MarkGCThing(cx, obj, "XPCWrappedNativeScope::mPrototypeJSFunction", arg);
}
}
void

Просмотреть файл

@ -121,8 +121,9 @@ XPCWrappedNativeScope::GetNewOrUsed(XPCCallContext& ccx, JSObject* aGlobal)
else
{
// We need to call SetGlobal in order to refresh our cached
// mPrototypeJSObject in the case where the global object is being
// reused (JS_ClearScope has been called).
// mPrototypeJSObject and mPrototypeJSFunction in the case where
// the global object is being reused (JS_ClearScope has been
// called).
// NOTE: We are only called by nsXPConnect::InitClasses.
scope->SetGlobal(ccx, aGlobal);
}
@ -137,7 +138,8 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(XPCCallContext& ccx,
mComponents(nsnull),
mNext(nsnull),
mGlobalJSObject(nsnull),
mPrototypeJSObject(nsnull)
mPrototypeJSObject(nsnull),
mPrototypeJSFunction(nsnull)
{
// add ourselves to the scopes list
{ // scoped lock
@ -317,6 +319,11 @@ XPCWrappedNativeScope::FinishedMarkPhaseOfGC(JSContext* cx, XPCJSRuntime* rt)
{
cur->mPrototypeJSObject = nsnull;
}
else if(cur->mPrototypeJSFunction &&
JS_IsAboutToBeFinalized(cx, cur->mPrototypeJSFunction))
{
cur->mPrototypeJSFunction = nsnull;
}
if(cur)
prev = cur;
cur = next;
@ -757,6 +764,7 @@ XPCWrappedNativeScope::DebugDump(PRInt16 depth)
XPC_LOG_ALWAYS(("mComponents @ %x", mComponents));
XPC_LOG_ALWAYS(("mGlobalJSObject @ %x", mGlobalJSObject));
XPC_LOG_ALWAYS(("mPrototypeJSObject @ %x", mPrototypeJSObject));
XPC_LOG_ALWAYS(("mPrototypeJSFunction @ %x", mPrototypeJSFunction));
XPC_LOG_ALWAYS(("mWrappedNativeMap @ %x with %d wrappers(s)", \
mWrappedNativeMap, \