Bug 693172 - Moved all subclasses of nsDOMEventTargetWrapperCache to nsDOMEventTargetHelper and then merged the classes. r=smaug

This commit is contained in:
Edmund Wong 2012-02-08 10:53:33 +08:00
parent d97e2cbe45
commit e79d1c340c
33 changed files with 229 additions and 355 deletions

View File

@ -77,7 +77,6 @@ nsLineBreaker.h \
nsReferencedElement.h \
nsTreeSanitizer.h \
nsXMLNameSpaceMap.h \
nsDOMEventTargetWrapperCache.h \
nsIXFormsUtilityService.h \
$(NULL)

View File

@ -1,147 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Wellington Fernando de Macedo.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Wellington Fernando de Macedo <wfernandom2004@gmail.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDOMEventTargetWrapperCache_h__
#define nsDOMEventTargetWrapperCache_h__
#include "nsDOMEventTargetHelper.h"
#include "nsWrapperCache.h"
#include "nsIScriptContext.h"
// Base class intended to be used for objets like XMLHttpRequest,
// EventSource and WebSocket.
class nsDOMEventTargetWrapperCache : public nsDOMEventTargetHelper,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMEventTargetWrapperCache,
nsDOMEventTargetHelper)
void GetParentObject(nsIScriptGlobalObject **aParentObject)
{
if (mOwner) {
CallQueryInterface(mOwner, aParentObject);
}
else {
*aParentObject = nsnull;
}
}
static nsDOMEventTargetWrapperCache* FromSupports(nsISupports* aSupports)
{
nsIDOMEventTarget* target =
static_cast<nsIDOMEventTarget*>(aSupports);
#ifdef DEBUG
{
nsCOMPtr<nsIDOMEventTarget> target_qi =
do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMEventTarget pointer as the
// nsISupports pointer. That must be fixed, or we'll crash...
NS_ASSERTION(target_qi == target, "Uh, fix QI!");
}
#endif
return static_cast<nsDOMEventTargetWrapperCache*>(target);
}
void Init(JSContext* aCx = nsnull);
protected:
nsDOMEventTargetWrapperCache() : nsDOMEventTargetHelper(), nsWrapperCache() {}
virtual ~nsDOMEventTargetWrapperCache();
};
#define NS_DECL_EVENT_HANDLER(_event) \
protected: \
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
public:
#define NS_DECL_AND_IMPL_EVENT_HANDLER(_event) \
protected: \
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
public: \
NS_IMETHOD GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return GetInnerEventListener(mOn##_event##Listener, a##_event); \
} \
NS_IMETHOD SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return RemoveAddEventListener(NS_LITERAL_STRING(#_event), \
mOn##_event##Listener, a##_event); \
}
#define NS_IMPL_EVENT_HANDLER(_class, _event) \
NS_IMETHODIMP \
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return GetInnerEventListener(mOn##_event##Listener, a##_event); \
} \
NS_IMETHODIMP \
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return RemoveAddEventListener(NS_LITERAL_STRING(#_event), \
mOn##_event##Listener, a##_event); \
}
#define NS_IMPL_FORWARD_EVENT_HANDLER(_class, _event, _baseclass) \
NS_IMETHODIMP \
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return _baseclass::GetOn##_event(a##_event); \
} \
NS_IMETHODIMP \
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return _baseclass::SetOn##_event(a##_event); \
}
#define NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(_event) \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOn##_event##Listener)
#define NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(_event) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOn##_event##Listener)
#endif // nsDOMEventTargetWrapperCache_h__

View File

@ -54,19 +54,19 @@ namespace dom {
const PRUint64 kUnknownSize = PRUint64(-1);
NS_IMPL_ADDREF_INHERITED(FileIOObject, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(FileIOObject, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(FileIOObject, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(FileIOObject, nsDOMEventTargetHelper)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileIOObject)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_CLASS(FileIOObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FileIOObject,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mProgressNotifier)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(abort)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(error)
@ -74,7 +74,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FileIOObject,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FileIOObject,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mProgressNotifier)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(abort)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(error)

View File

@ -39,7 +39,7 @@
#define FileIOObject_h__
#include "nsIDOMEventTarget.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIChannel.h"
#include "nsIFile.h"
#include "nsIDOMFile.h"
@ -57,7 +57,7 @@ extern const PRUint64 kUnknownSize;
// A common base class for FileReader and FileSaver
class FileIOObject : public nsDOMEventTargetWrapperCache,
class FileIOObject : public nsDOMEventTargetHelper,
public nsIStreamListener,
public nsITimerCallback
{
@ -82,7 +82,7 @@ public:
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileIOObject,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
protected:
// Implemented by the derived class to do whatever it needs to do for abort

View File

@ -98,7 +98,6 @@ CPPSRCS = \
nsDOMAttributeMap.cpp \
nsDOMBlobBuilder.cpp \
nsDOMDocumentType.cpp \
nsDOMEventTargetWrapperCache.cpp \
nsDOMFile.cpp \
nsDOMFileReader.cpp \
nsDOMLists.cpp \

View File

@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Wellington Fernando de Macedo.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Wellington Fernando de Macedo <wfernandom2004@gmail.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsContentUtils.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsIDocument.h"
#include "nsIJSContextStack.h"
#include "nsServiceManagerUtils.h"
#include "nsDOMJSUtils.h"
#include "nsWrapperCacheInlines.h"
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMEventTargetWrapperCache,
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMEventTargetWrapperCache,
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMEventTargetWrapperCache)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsDOMEventTargetWrapperCache, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsDOMEventTargetWrapperCache, nsDOMEventTargetHelper)
void
nsDOMEventTargetWrapperCache::Init(JSContext* aCx)
{
// Set the original mScriptContext and mPrincipal, if available
JSContext* cx = aCx;
if (!cx) {
nsIJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
if (!stack)
return;
if (NS_FAILED(stack->Peek(&cx)) || !cx)
return;
}
NS_ASSERTION(cx, "Should have returned earlier ...");
nsIScriptContext* context = GetScriptContextFromJSContext(cx);
if (context) {
mScriptContext = context;
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(context->GetGlobalObject());
if (window)
mOwner = window->GetCurrentInnerWindow();
}
}
nsDOMEventTargetWrapperCache::~nsDOMEventTargetWrapperCache()
{
nsContentUtils::ReleaseWrapper(this, this);
}

View File

@ -79,6 +79,7 @@
#include "xpcpublic.h"
#include "nsIScriptSecurityManager.h"
#include "nsDOMJSUtils.h"
#include "nsDOMEventTargetHelper.h"
#include "jstypedarray.h"
@ -114,7 +115,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsDOMFileReader,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
if(tmp->mResultArrayBuffer) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(tmp->mResultArrayBuffer,
"mResultArrayBuffer")
@ -173,7 +174,7 @@ nsDOMFileReader::~nsDOMFileReader()
nsresult
nsDOMFileReader::Init()
{
nsDOMEventTargetWrapperCache::Init();
nsDOMEventTargetHelper::Init();
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> subjectPrincipal;

View File

@ -64,6 +64,7 @@
#include "xpcpublic.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsWrapperCacheInlines.h"
#include "nsDOMEventTargetHelper.h"
using namespace mozilla;
@ -127,11 +128,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsEventSource)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSrc)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNotificationCallbacks)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLoadGroup)
@ -144,7 +145,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsEventSource,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mUnicodeDecoder)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsEventSource, nsDOMEventTargetWrapperCache)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsEventSource, nsDOMEventTargetHelper)
tmp->Close();
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnOpenListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnMessageListener)
@ -163,10 +164,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsEventSource)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(EventSource)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsEventSource, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(nsEventSource, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(nsEventSource, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsEventSource, nsDOMEventTargetHelper)
//-----------------------------------------------------------------------------
// nsEventSource::nsIEventSource

View File

@ -48,7 +48,7 @@
#include "nsIEventSource.h"
#include "nsIJSNativeInitializer.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIObserver.h"
#include "nsIStreamListener.h"
#include "nsIChannelEventSink.h"
@ -69,7 +69,7 @@
class AsyncVerifyRedirectCallbackFwr;
class nsAutoClearFields;
class nsEventSource: public nsDOMEventTargetWrapperCache,
class nsEventSource: public nsDOMEventTargetHelper,
public nsIEventSource,
public nsIJSNativeInitializer,
public nsIObserver,
@ -85,7 +85,7 @@ public:
virtual ~nsEventSource();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(nsEventSource,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_DECL_NSIEVENTSOURCE

View File

@ -144,13 +144,13 @@ nsInProcessTabChildGlobal::Init()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsInProcessTabChildGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mMessageManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
nsFrameScriptExecutor::Traverse(tmp, cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -163,7 +163,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsInProcessTabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIScriptContextPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsInProcessTabChildGlobal, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsInProcessTabChildGlobal, nsDOMEventTargetHelper)

View File

@ -42,7 +42,7 @@
#include "nsCOMPtr.h"
#include "nsFrameMessageManager.h"
#include "nsIScriptContext.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptContext.h"
#include "nsIClassInfo.h"
@ -52,7 +52,7 @@
#include "nsCOMArray.h"
#include "nsThreadUtils.h"
class nsInProcessTabChildGlobal : public nsDOMEventTargetWrapperCache,
class nsInProcessTabChildGlobal : public nsDOMEventTargetHelper,
public nsFrameScriptExecutor,
public nsIInProcessContentFrameMessageManager,
public nsIScriptObjectPrincipal,
@ -64,7 +64,7 @@ public:
virtual ~nsInProcessTabChildGlobal();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
const jsval& aObject,

View File

@ -83,6 +83,7 @@
#include "prmem.h"
#include "nsDOMFile.h"
#include "nsWrapperCacheInlines.h"
#include "nsDOMEventTargetHelper.h"
using namespace mozilla;
@ -459,11 +460,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsWebSocket)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnOpenListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnMessageListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnCloseListener)
@ -474,7 +475,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsWebSocket,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
tmp->Disconnect();
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnOpenListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnMessageListener)
@ -494,10 +495,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsWebSocket)
NS_INTERFACE_MAP_ENTRY(nsIWebSocketListener)
NS_INTERFACE_MAP_ENTRY(nsIRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebSocket)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsWebSocket, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(nsWebSocket, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(nsWebSocket, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsWebSocket, nsDOMEventTargetHelper)
//-----------------------------------------------------------------------------
// nsWebSocket::nsIJSNativeInitializer methods:

View File

@ -48,7 +48,7 @@
#include "nsIPrincipal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDOMEventListener.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsAutoPtr.h"
#include "nsIDOMDOMStringList.h"
#include "nsIInterfaceRequestor.h"
@ -69,7 +69,7 @@
class nsWSCloseEvent;
class nsAutoCloseWS;
class nsWebSocket: public nsDOMEventTargetWrapperCache,
class nsWebSocket: public nsDOMEventTargetHelper,
public nsIWebSocket,
public nsIJSNativeInitializer,
public nsIInterfaceRequestor,
@ -84,7 +84,7 @@ public:
virtual ~nsWebSocket();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_DECL_NSIWEBSOCKET
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBSOCKETLISTENER

View File

@ -300,7 +300,7 @@ nsMultipartProxyListener::OnDataAvailable(nsIRequest *aRequest,
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXHREventTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXHREventTarget,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnAbortListener)
@ -311,7 +311,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXHREventTarget,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXHREventTarget,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnAbortListener)
@ -323,10 +323,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXHREventTarget)
NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequestEventTarget)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsXHREventTarget, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(nsXHREventTarget, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)
NS_IMETHODIMP
nsXHREventTarget::GetOnload(nsIDOMEventListener** aOnLoad)

View File

@ -63,7 +63,7 @@
#include "nsITimer.h"
#include "nsIPrivateDOMEvent.h"
#include "nsDOMProgressEvent.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsContentUtils.h"
#include "nsDOMFile.h"
#include "nsDOMBlobBuilder.h"
@ -72,14 +72,14 @@ class nsILoadGroup;
class AsyncVerifyRedirectCallbackForwarder;
class nsIUnicodeDecoder;
class nsXHREventTarget : public nsDOMEventTargetWrapperCache,
class nsXHREventTarget : public nsDOMEventTargetHelper,
public nsIXMLHttpRequestEventTarget
{
public:
virtual ~nsXHREventTarget() {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXHREventTarget,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_DECL_NSIXMLHTTPREQUESTEVENTTARGET
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)

View File

@ -41,9 +41,10 @@
#include "nsEventDispatcher.h"
#include "nsGUIEvent.h"
#include "nsIDocument.h"
#include "nsIJSContextStack.h"
#include "nsDOMJSUtils.h"
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventListenerWrapper)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventListenerWrapper)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_END_AGGREGATED(mListener)
@ -67,7 +68,12 @@ nsDOMEventListenerWrapper::HandleEvent(nsIDOMEvent* aEvent)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContext)
@ -75,12 +81,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mScriptContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventTargetHelper)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_END
@ -95,6 +103,7 @@ nsDOMEventTargetHelper::~nsDOMEventTargetHelper()
if (mListenerManager) {
mListenerManager->Disconnect();
}
nsContentUtils::ReleaseWrapper(this, this);
}
NS_IMETHODIMP
@ -251,3 +260,28 @@ nsDOMEventTargetHelper::GetContextForEventHandlers(nsresult* aRv)
return mScriptContext;
}
void
nsDOMEventTargetHelper::Init(JSContext* aCx)
{
// Set the original mScriptContext and mPrincipal, if available
JSContext* cx = aCx;
if (!cx) {
nsIJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
if (!stack)
return;
if (NS_FAILED(stack->Peek(&cx)) || !cx)
return;
}
NS_ASSERTION(cx, "Should have returned earlier ...");
nsIScriptContext* context = GetScriptContextFromJSContext(cx);
if (context) {
mScriptContext = context;
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(context->GetGlobalObject());
if (window)
mOwner = window->GetCurrentInnerWindow();
}
}

View File

@ -48,6 +48,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsEventListenerManager.h"
#include "nsIScriptContext.h"
#include "nsWrapperCache.h"
class nsDOMEventListenerWrapper : public nsIDOMEventListener
{
@ -65,16 +66,48 @@ protected:
nsCOMPtr<nsIDOMEventListener> mListener;
};
class nsDOMEventTargetHelper : public nsIDOMEventTarget
class nsDOMEventTargetHelper : public nsIDOMEventTarget,
public nsWrapperCache
{
public:
nsDOMEventTargetHelper() {}
virtual ~nsDOMEventTargetHelper();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMEventTargetHelper)
NS_DECL_NSIDOMEVENTTARGET
void GetParentObject(nsIScriptGlobalObject **aParentObject)
{
if (mOwner) {
CallQueryInterface(mOwner, aParentObject);
}
else {
*aParentObject = nsnull;
}
}
static nsDOMEventTargetHelper* FromSupports(nsISupports* aSupports)
{
nsIDOMEventTarget* target =
static_cast<nsIDOMEventTarget*>(aSupports);
#ifdef DEBUG
{
nsCOMPtr<nsIDOMEventTarget> target_qi =
do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMEventTarget pointer as the
// nsISupports pointer. That must be fixed, or we'll crash...
NS_ASSERTION(target_qi == target, "Uh, fix QI!");
}
#endif
return static_cast<nsDOMEventTargetHelper*>(target);
}
void Init(JSContext* aCx = nsnull);
bool HasListenersFor(const nsAString& aType)
{
return mListenerManager && mListenerManager->HasListenersFor(aType);
@ -104,6 +137,56 @@ protected:
nsCOMPtr<nsPIDOMWindow> mOwner; // Inner window.
};
#define NS_DECL_EVENT_HANDLER(_event) \
protected: \
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
public:
#define NS_DECL_AND_IMPL_EVENT_HANDLER(_event) \
protected: \
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
public: \
NS_IMETHOD GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return GetInnerEventListener(mOn##_event##Listener, a##_event); \
} \
NS_IMETHOD SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return RemoveAddEventListener(NS_LITERAL_STRING(#_event), \
mOn##_event##Listener, a##_event); \
}
#define NS_IMPL_EVENT_HANDLER(_class, _event) \
NS_IMETHODIMP \
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return GetInnerEventListener(mOn##_event##Listener, a##_event); \
} \
NS_IMETHODIMP \
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return RemoveAddEventListener(NS_LITERAL_STRING(#_event), \
mOn##_event##Listener, a##_event); \
}
#define NS_IMPL_FORWARD_EVENT_HANDLER(_class, _event, _baseclass) \
NS_IMETHODIMP \
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
{ \
return _baseclass::GetOn##_event(a##_event); \
} \
NS_IMETHODIMP \
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
{ \
return _baseclass::SetOn##_event(a##_event); \
}
#define NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(_event) \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOn##_event##Listener)
#define NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(_event) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOn##_event##Listener)
#define NS_UNMARK_LISTENER_WRAPPER(_event) \
if (tmp->mOn##_event##Listener) { \
nsCOMPtr<nsIXPConnectWrappedJS> wjs = \

View File

@ -80,7 +80,7 @@
#include "nsCSSValue.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "xpcprivate.h"
#include "XrayWrapper.h"
@ -7631,8 +7631,8 @@ NS_IMETHODIMP
nsEventTargetSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)
{
nsDOMEventTargetWrapperCache *target =
nsDOMEventTargetWrapperCache::FromSupports(nativeObj);
nsDOMEventTargetHelper *target =
nsDOMEventTargetHelper::FromSupports(nativeObj);
nsCOMPtr<nsIScriptGlobalObject> native_parent;
target->GetParentObject(getter_AddRefs(native_parent));
@ -7658,8 +7658,8 @@ nsEventTargetSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
void
nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
{
nsDOMEventTargetWrapperCache *target =
nsDOMEventTargetWrapperCache::FromSupports(aNative);
nsDOMEventTargetHelper *target =
nsDOMEventTargetHelper::FromSupports(aNative);
nsContentUtils::PreserveWrapper(aNative, target);
}

View File

@ -42,6 +42,7 @@
#include "Constants.h"
#include "nsDOMEvent.h"
#include "mozilla/Preferences.h"
#include "nsDOMEventTargetHelper.h"
/**
* We have to use macros here because our leak analysis tool things we are
@ -61,7 +62,7 @@ namespace battery {
NS_IMPL_CYCLE_COLLECTION_CLASS(BatteryManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BatteryManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(levelchange)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(chargingchange)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(chargingtimechange)
@ -69,7 +70,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BatteryManager,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BatteryManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(levelchange)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(chargingchange)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(chargingtimechange)
@ -79,10 +80,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BatteryManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozBatteryManager)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozBatteryManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(BatteryManager, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(BatteryManager, nsDOMEventTargetHelper)
BatteryManager::BatteryManager()
: mLevel(kDefaultLevel)

View File

@ -39,10 +39,11 @@
#define mozilla_dom_battery_BatteryManager_h
#include "nsIDOMBatteryManager.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Observer.h"
#include "Types.h"
#include "nsDOMEventTargetHelper.h"
class nsPIDOMWindow;
class nsIScriptContext;
@ -56,14 +57,14 @@ class BatteryInformation;
namespace dom {
namespace battery {
class BatteryManager : public nsDOMEventTargetWrapperCache
class BatteryManager : public nsDOMEventTargetHelper
, public nsIDOMMozBatteryManager
, public BatteryObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZBATTERYMANAGER
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
BatteryManager();
@ -74,7 +75,7 @@ public:
void Notify(const hal::BatteryInformation& aBatteryInfo);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BatteryManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
/**
* Returns whether the battery api is supported (ie. not disabled by the user)

View File

@ -59,6 +59,7 @@
#include "IndexedDatabaseManager.h"
#include "TransactionThreadPool.h"
#include "DictionaryHelpers.h"
#include "nsDOMEventTargetHelper.h"
USING_INDEXEDDB_NAMESPACE

View File

@ -44,7 +44,7 @@
#include "nsIDocument.h"
#include "nsIIDBDatabase.h"
#include "nsDOMEventTargetHelper.h"
#include "mozilla/dom/indexedDB/IDBWrapperCache.h"
#include "mozilla/dom/indexedDB/FileManager.h"

View File

@ -45,7 +45,7 @@
#include "nsIIDBRequest.h"
#include "nsIIDBOpenDBRequest.h"
#include "nsDOMEventTargetHelper.h"
#include "mozilla/dom/indexedDB/IDBWrapperCache.h"
class nsIScriptContext;

View File

@ -11,18 +11,18 @@ USING_INDEXEDDB_NAMESPACE
NS_IMPL_CYCLE_COLLECTION_CLASS(IDBWrapperCache)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBWrapperCache,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
// Don't need NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS because
// nsDOMEventTargetHelper does it for us.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBWrapperCache,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
tmp->mScriptOwner = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(IDBWrapperCache,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
// Don't need NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER because
// nsDOMEventTargetHelper does it for us.
if (tmp->mScriptOwner) {
@ -32,7 +32,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(IDBWrapperCache,
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(IDBWrapperCache, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(IDBWrapperCache, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(IDBWrapperCache, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(IDBWrapperCache, nsDOMEventTargetHelper)

View File

@ -9,17 +9,17 @@
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
BEGIN_INDEXEDDB_NAMESPACE
class IDBWrapperCache : public nsDOMEventTargetWrapperCache
class IDBWrapperCache : public nsDOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
IDBWrapperCache,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
JSObject* GetScriptOwner() const
{
@ -44,7 +44,7 @@ public:
// Do what nsEventTargetSH::PreCreate does.
nsCOMPtr<nsIScriptGlobalObject> parent;
nsDOMEventTargetWrapperCache::GetParentObject(getter_AddRefs(parent));
nsDOMEventTargetHelper::GetParentObject(getter_AddRefs(parent));
return parent ? parent->GetGlobalJSObject() : nsnull;
}
@ -52,7 +52,7 @@ public:
static IDBWrapperCache* FromSupports(nsISupports* aSupports)
{
return static_cast<IDBWrapperCache*>(
nsDOMEventTargetWrapperCache::FromSupports(aSupports));
nsDOMEventTargetHelper::FromSupports(aSupports));
}
protected:

View File

@ -1002,12 +1002,12 @@ TabChildGlobal::TabChildGlobal(TabChild* aTabChild)
NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mMessageManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildGlobal,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -1018,7 +1018,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIScriptContextPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)

View File

@ -65,7 +65,7 @@
#include "nsNetUtil.h"
#include "nsFrameMessageManager.h"
#include "nsIScriptContext.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIDialogCreator.h"
#include "nsIDialogParamBlock.h"
#include "nsIPresShell.h"
@ -87,7 +87,7 @@ namespace dom {
class TabChild;
class PContentDialogChild;
class TabChildGlobal : public nsDOMEventTargetWrapperCache,
class TabChildGlobal : public nsDOMEventTargetHelper,
public nsIContentFrameMessageManager,
public nsIScriptObjectPrincipal,
public nsIScriptContextPrincipal
@ -95,7 +95,7 @@ class TabChildGlobal : public nsDOMEventTargetWrapperCache,
public:
TabChildGlobal(TabChild* aTabChild);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetWrapperCache)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
const jsval& aObject,

View File

@ -61,12 +61,12 @@ const bool Connection::sMeteredDefaultValue = false;
NS_IMPL_CYCLE_COLLECTION_CLASS(Connection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Connection,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(change)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Connection,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(change)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -74,10 +74,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Connection)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozConnection)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozConnection)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozConnection)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(Connection, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(Connection, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(Connection, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(Connection, nsDOMEventTargetHelper)
Connection::Connection()
: mCanBeMetered(kDefaultCanBeMetered)

View File

@ -39,7 +39,7 @@
#define mozilla_dom_network_Connection_h
#include "nsIDOMConnection.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Observer.h"
#include "Types.h"
@ -53,7 +53,7 @@ class NetworkInformation;
namespace dom {
namespace network {
class Connection : public nsDOMEventTargetWrapperCache
class Connection : public nsDOMEventTargetHelper
, public nsIDOMMozConnection
, public NetworkObserver
{
@ -61,7 +61,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZCONNECTION
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
Connection();
@ -72,7 +72,7 @@ public:
void Notify(const hal::NetworkInformation& aNetworkInfo);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Connection,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
private:
/**

View File

@ -68,14 +68,14 @@ namespace sms {
NS_IMPL_CYCLE_COLLECTION_CLASS(SmsManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SmsManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(received)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(sent)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(delivered)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SmsManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(received)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(sent)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(delivered)
@ -85,10 +85,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SmsManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsManager)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozSmsManager)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(SmsManager, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(SmsManager, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(SmsManager, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(SmsManager, nsDOMEventTargetHelper)
void
SmsManager::Init(nsPIDOMWindow *aWindow, nsIScriptContext* aScriptContext)

View File

@ -40,7 +40,7 @@
#include "nsIDOMSmsManager.h"
#include "nsIObserver.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
class nsIDOMMozSmsMessage;
@ -50,17 +50,17 @@ namespace sms {
class SmsManager : public nsIDOMMozSmsManager
, public nsIObserver
, public nsDOMEventTargetWrapperCache
, public nsDOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_DECL_NSIDOMMOZSMSMANAGER
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SmsManager,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
void Init(nsPIDOMWindow *aWindow, nsIScriptContext* aScriptContext);
void Shutdown();

View File

@ -51,7 +51,7 @@ namespace sms {
NS_IMPL_CYCLE_COLLECTION_CLASS(SmsRequest)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SmsRequest,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(success)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(error)
@ -59,7 +59,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SmsRequest,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SmsRequest,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
if (tmp->mResultRooted) {
tmp->mResult = JSVAL_VOID;
tmp->UnrootResult();
@ -70,7 +70,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SmsRequest,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(SmsRequest,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
if (JSVAL_IS_GCTHING(tmp->mResult)) {
void *gcThing = JSVAL_TO_GCTHING(tmp->mResult);
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(gcThing, "mResult")
@ -81,10 +81,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SmsRequest)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsRequest)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozSmsRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsRequest)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(SmsRequest, nsDOMEventTargetWrapperCache)
NS_IMPL_RELEASE_INHERITED(SmsRequest, nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(SmsRequest, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(SmsRequest, nsDOMEventTargetHelper)
NS_IMPL_EVENT_HANDLER(SmsRequest, success)
NS_IMPL_EVENT_HANDLER(SmsRequest, error)

View File

@ -39,7 +39,7 @@
#define mozilla_dom_sms_SmsRequest_h
#include "nsIDOMSmsRequest.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsDOMEventTargetHelper.h"
class nsIDOMMozSmsMessage;
class nsIDOMMozSmsCursor;
@ -49,7 +49,7 @@ namespace dom {
namespace sms {
class SmsRequest : public nsIDOMMozSmsRequest
, public nsDOMEventTargetWrapperCache
, public nsDOMEventTargetHelper
{
public:
friend class SmsRequestManager;
@ -70,10 +70,10 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZSMSREQUEST
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(SmsRequest,
nsDOMEventTargetWrapperCache)
nsDOMEventTargetHelper)
void Reset();