Bug 738700 - unmark wrapped gray objects from nsISupports. r=smaug

This commit is contained in:
Andrew McCreight 2012-03-28 21:51:46 -07:00
parent 6b700b5814
commit a59c979d1b
6 changed files with 12 additions and 19 deletions

View File

@ -1110,9 +1110,7 @@ nsFrameMessageManager::MarkForCC()
{
PRUint32 len = mListeners.Length();
for (PRUint32 i = 0; i < len; ++i) {
nsCOMPtr<nsIXPConnectWrappedJS> wjs =
do_QueryInterface(mListeners[i].mListener);
xpc_UnmarkGrayObject(wjs);
xpc_TryUnmarkWrappedGrayObject(mListeners[i].mListener);
}
return true;
}

View File

@ -4585,9 +4585,7 @@ void
nsGenericElement::MarkUserDataHandler(void* aObject, nsIAtom* aKey,
void* aChild, void* aData)
{
nsCOMPtr<nsIXPConnectWrappedJS> wjs =
do_QueryInterface(static_cast<nsISupports*>(aChild));
xpc_UnmarkGrayObject(wjs);
xpc_TryUnmarkWrappedGrayObject(static_cast<nsISupports*>(aChild));
}
void

View File

@ -201,9 +201,7 @@ private:
#define NS_UNMARK_LISTENER_WRAPPER(_event) \
if (tmp->mOn##_event##Listener) { \
nsCOMPtr<nsIXPConnectWrappedJS> wjs = \
do_QueryInterface(tmp->mOn##_event##Listener->GetInner()); \
xpc_UnmarkGrayObject(wjs); \
xpc_TryUnmarkWrappedGrayObject(tmp->mOn##_event##Listener->GetInner()); \
}
#endif // nsDOMEventTargetHelper_h_

View File

@ -1050,8 +1050,7 @@ nsEventListenerManager::UnmarkGrayJSListeners()
xpc_UnmarkGrayObject(jsl->GetHandler());
xpc_UnmarkGrayObject(jsl->GetEventScope());
} else if (ls.mWrappedJS) {
nsCOMPtr<nsIXPConnectWrappedJS> wjs = do_QueryInterface(ls.mListener);
xpc_UnmarkGrayObject(wjs);
xpc_TryUnmarkWrappedGrayObject(ls.mListener);
}
}
}

View File

@ -860,11 +860,12 @@ xpc_MarkInCCGeneration(nsISupports* aVariant, PRUint32 aGeneration)
}
void
xpc_UnmarkGrayObject(nsIXPConnectWrappedJS* aWrappedJS)
xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS)
{
if (aWrappedJS) {
nsCOMPtr<nsIXPConnectWrappedJS> wjs = do_QueryInterface(aWrappedJS);
if (wjs) {
// Unmarks gray JSObject.
static_cast<nsXPCWrappedJS*>(aWrappedJS)->GetJSObject();
static_cast<nsXPCWrappedJS*>(wjs.get())->GetJSObject();
}
}

View File

@ -55,7 +55,6 @@
#include "nsTArray.h"
class nsIPrincipal;
class nsIXPConnectWrappedJS;
struct nsDOMClassInfoData;
#ifndef BAD_TLS_INDEX
@ -196,9 +195,9 @@ xpc_UnmarkGrayObject(JSObject *obj)
extern void
xpc_MarkInCCGeneration(nsISupports* aVariant, PRUint32 aGeneration);
// Unmarks aWrappedJS's JSObject.
// If aWrappedJS is a JS wrapper, unmark its JSObject.
extern void
xpc_UnmarkGrayObject(nsIXPConnectWrappedJS* aWrappedJS);
xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS);
extern void
xpc_UnmarkSkippableJSHolders();