Bug 413447 - "nsXBLDocumentInfo can keep closed global window alive". r+sr=sicking, a=blocking1.9.

This commit is contained in:
bent.mozilla@gmail.com 2008-01-28 22:15:25 -08:00
parent faedce29c4
commit 5e954a2668
3 changed files with 12 additions and 21 deletions

View File

@ -361,12 +361,6 @@ nsXBLPrototypeBinding::Traverse(nsCycleCollectionTraversalCallback &cb) const
mInsertionPointTable->Enumerate(TraverseInsertionPoint, &cb);
if (mInterfaceTable)
mInterfaceTable->Enumerate(TraverseBinding, &cb);
nsXBLPrototypeHandler* curr = mPrototypeHandler;
while (curr) {
curr->Traverse(cb);
curr = curr->GetNextHandler();
}
}
void

View File

@ -161,12 +161,6 @@ nsXBLPrototypeHandler::~nsXBLPrototypeHandler()
delete mNextHandler;
}
void
nsXBLPrototypeHandler::Traverse(nsCycleCollectionTraversalCallback &cb) const
{
cb.NoteXPCOMChild(mGlobalForCachedHandler);
}
void
nsXBLPrototypeHandler::Trace(TraceCallback aCallback, void *aClosure) const
{
@ -375,12 +369,16 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
nsScriptObjectHolder &aHandler)
{
// Check to see if we've already compiled this
if (mCachedHandler && mGlobalForCachedHandler == aGlobal) {
aHandler.set(mCachedHandler);
if (!aHandler)
return NS_ERROR_FAILURE;
return NS_OK;
if (mCachedHandler) {
nsCOMPtr<nsIScriptGlobalObject> cachedGlobal =
do_QueryReferent(mGlobalForCachedHandler);
if (cachedGlobal == aGlobal) {
aHandler.set(mCachedHandler);
if (!aHandler)
return NS_ERROR_FAILURE;
return NS_OK;
}
}
// Ensure that we have something to compile
@ -401,7 +399,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
NS_ENSURE_SUCCESS(rv, rv);
mCachedHandler = aHandler;
mGlobalForCachedHandler = aGlobal;
mGlobalForCachedHandler = do_GetWeakReference(aGlobal);
return NS_OK;
}

View File

@ -153,7 +153,6 @@ public:
return (mType & NS_HANDLER_ALLOW_UNTRUSTED) != 0;
}
void Traverse(nsCycleCollectionTraversalCallback &cb) const;
void Trace(TraceCallback aCallback, void *aClosure) const;
void Unlink();
@ -233,7 +232,7 @@ protected:
// cache a handler to avoid compiling each time
void *mCachedHandler;
nsCOMPtr<nsIScriptGlobalObject> mGlobalForCachedHandler;
nsWeakPtr mGlobalForCachedHandler;
// Prototype handlers are chained. We own the next handler in the chain.
nsXBLPrototypeHandler* mNextHandler;