Bug 719949 - Unmark listeners in XHR, WebSocket and EventSource if the object is black, r=mccr8

--HG--
extra : rebase_source : ceff390170c3ad35baa33a7f16ec39e3393a81be
This commit is contained in:
Olli Pettay 2012-01-26 16:55:30 +01:00
Родитель bd43197001
Коммит 2df43f0d64
6 изменённых файлов: 83 добавлений и 6 удалений

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

@ -63,6 +63,7 @@
#include "mozilla/Preferences.h"
#include "xpcpublic.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
@ -105,6 +106,30 @@ nsEventSource::~nsEventSource()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventSource)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsEventSource)
if (tmp->IsBlack()) {
if (tmp->mListenerManager) {
tmp->mListenerManager->UnmarkGrayJSListeners();
NS_UNMARK_LISTENER_WRAPPER(Open)
NS_UNMARK_LISTENER_WRAPPER(Message)
NS_UNMARK_LISTENER_WRAPPER(Error)
}
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsEventSource)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsEventSource)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSrc)

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

@ -84,8 +84,8 @@ public:
nsEventSource();
virtual ~nsEventSource();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
NS_DECL_NSIEVENTSOURCE

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

@ -82,6 +82,7 @@
#include "jstypedarray.h"
#include "prmem.h"
#include "nsDOMFile.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
@ -429,6 +430,31 @@ nsWebSocket::~nsWebSocket()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsWebSocket)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsWebSocket)
if (tmp->IsBlack()) {
if (tmp->mListenerManager) {
tmp->mListenerManager->UnmarkGrayJSListeners();
NS_UNMARK_LISTENER_WRAPPER(Open)
NS_UNMARK_LISTENER_WRAPPER(Error)
NS_UNMARK_LISTENER_WRAPPER(Message)
NS_UNMARK_LISTENER_WRAPPER(Close)
}
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsWebSocket)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsWebSocket)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnOpenListener)

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

@ -83,8 +83,8 @@ public:
nsWebSocket();
virtual ~nsWebSocket();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
NS_DECL_NSIWEBSOCKET
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBSOCKETLISTENER

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

@ -105,6 +105,7 @@
#include "nsIFileChannel.h"
#include "mozilla/Telemetry.h"
#include "sampler.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
@ -578,6 +579,31 @@ nsXMLHttpRequest::SetRequestObserver(nsIRequestObserver* aObserver)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXMLHttpRequest)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsXMLHttpRequest)
if (tmp->IsBlack()) {
if (tmp->mListenerManager) {
tmp->mListenerManager->UnmarkGrayJSListeners();
NS_UNMARK_LISTENER_WRAPPER(Load)
NS_UNMARK_LISTENER_WRAPPER(Error)
NS_UNMARK_LISTENER_WRAPPER(Abort)
NS_UNMARK_LISTENER_WRAPPER(LoadStart)
NS_UNMARK_LISTENER_WRAPPER(Progress)
NS_UNMARK_LISTENER_WRAPPER(Loadend)
NS_UNMARK_LISTENER_WRAPPER(UploadProgress)
NS_UNMARK_LISTENER_WRAPPER(Readystatechange)
}
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsXMLHttpRequest)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsXMLHttpRequest)
return tmp->IsBlack();
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContext)

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

@ -199,8 +199,8 @@ public:
void SetRequestObserver(nsIRequestObserver* aObserver);
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
bool AllowUploadProgress();
void RootResultArrayBuffer();