mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Back out the code changes from Bug 687332 until we figure out a compat story.
This commit is contained in:
parent
449047ac82
commit
cff8ea3636
@ -94,52 +94,54 @@ protected:
|
||||
};
|
||||
|
||||
#define NS_DECL_EVENT_HANDLER(_event) \
|
||||
public: \
|
||||
NS_IMETHOD GetOn##_event(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##_event(JSContext *cx, const jsval &vp);
|
||||
protected: \
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
|
||||
public:
|
||||
|
||||
#define NS_DECL_AND_IMPL_EVENT_HANDLER(_event) \
|
||||
protected: \
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOn##_event##Listener; \
|
||||
public: \
|
||||
NS_IMPL_EVENT_HANDLER(_class, _event)
|
||||
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(JSContext *cx, jsval *vp) \
|
||||
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
|
||||
{ \
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_FALSE); \
|
||||
if (elm) { \
|
||||
elm->GetJSEventListener(nsGkAtoms::on##_event, vp); \
|
||||
} else { \
|
||||
*vp = JSVAL_NULL; \
|
||||
} \
|
||||
return NS_OK; \
|
||||
return GetInnerEventListener(mOn##_event##Listener, a##_event); \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::SetOn##_event(JSContext *cx, const jsval &vp) \
|
||||
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
|
||||
{ \
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_TRUE); \
|
||||
if (!elm) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
JSObject *obj = GetWrapper(); \
|
||||
if (!obj) { \
|
||||
/* Just silently do nothing */ \
|
||||
return NS_OK; \
|
||||
} \
|
||||
return elm->SetJSEventListenerToJsval(nsGkAtoms::on##_event, cx, obj, vp);\
|
||||
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(JSContext *cx, jsval *vp) \
|
||||
_class::GetOn##_event(nsIDOMEventListener** a##_event) \
|
||||
{ \
|
||||
return _baseclass::GetOn##_event(cx, vp); \
|
||||
return _baseclass::GetOn##_event(a##_event); \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::SetOn##_event(JSContext *cx, const jsval &vp) \
|
||||
_class::SetOn##_event(nsIDOMEventListener* a##_event) \
|
||||
{ \
|
||||
return _baseclass::SetOn##_event(cx, vp); \
|
||||
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__
|
||||
|
@ -41,7 +41,7 @@ interface nsIDOMEventListener;
|
||||
interface nsIDOMBlob;
|
||||
interface nsIDOMFileError;
|
||||
|
||||
[scriptable, builtinclass, uuid(57d68e17-85fa-4509-bf71-ffac1b22a174)]
|
||||
[scriptable, builtinclass, uuid(fc316500-87c4-411e-ab75-dd62468f4174)]
|
||||
interface nsIDOMFileReader : nsIDOMEventTarget
|
||||
{
|
||||
[implicit_jscontext]
|
||||
@ -61,12 +61,12 @@ interface nsIDOMFileReader : nsIDOMEventTarget
|
||||
readonly attribute jsval result;
|
||||
readonly attribute nsIDOMFileError error;
|
||||
|
||||
[implicit_jscontext] attribute jsval onloadstart;
|
||||
[implicit_jscontext] attribute jsval onprogress;
|
||||
[implicit_jscontext] attribute jsval onload;
|
||||
[implicit_jscontext] attribute jsval onabort;
|
||||
[implicit_jscontext] attribute jsval onerror;
|
||||
[implicit_jscontext] attribute jsval onloadend;
|
||||
attribute nsIDOMEventListener onloadstart;
|
||||
attribute nsIDOMEventListener onprogress;
|
||||
attribute nsIDOMEventListener onload;
|
||||
attribute nsIDOMEventListener onabort;
|
||||
attribute nsIDOMEventListener onerror;
|
||||
attribute nsIDOMEventListener onloadend;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -51,7 +51,7 @@ interface nsIPrincipal;
|
||||
interface nsIScriptContext;
|
||||
interface nsPIDOMWindow;
|
||||
|
||||
[scriptable, uuid(741374e9-39ed-4712-a380-93e023b271f8)]
|
||||
[scriptable, uuid(755e2d2d-a836-4539-83f4-16b51156341f)]
|
||||
interface nsIEventSource : nsISupports
|
||||
{
|
||||
readonly attribute DOMString url;
|
||||
@ -63,9 +63,9 @@ interface nsIEventSource : nsISupports
|
||||
readonly attribute long readyState;
|
||||
|
||||
// event handler attributes
|
||||
[implicit_jscontext] attribute jsval onopen;
|
||||
[implicit_jscontext] attribute jsval onmessage;
|
||||
[implicit_jscontext] attribute jsval onerror;
|
||||
attribute nsIDOMEventListener onopen;
|
||||
attribute nsIDOMEventListener onmessage;
|
||||
attribute nsIDOMEventListener onerror;
|
||||
|
||||
/**
|
||||
* Close the connection, if any, and set the readyState attribute to CLOSED.
|
||||
|
@ -53,18 +53,18 @@ interface nsIDOMBlob;
|
||||
#include "jsapi.h"
|
||||
%}
|
||||
|
||||
[scriptable, builtinclass, uuid(8bc1357c-fe70-4741-a170-8fa50b6d23be)]
|
||||
[scriptable, builtinclass, uuid(dea238a1-240f-45f4-9f07-7769bc69eb76)]
|
||||
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
|
||||
// event handler attributes
|
||||
[implicit_jscontext] attribute jsval onabort;
|
||||
[implicit_jscontext] attribute jsval onerror;
|
||||
[implicit_jscontext] attribute jsval onload;
|
||||
[implicit_jscontext] attribute jsval onloadstart;
|
||||
[implicit_jscontext] attribute jsval onprogress;
|
||||
[implicit_jscontext] attribute jsval onloadend;
|
||||
attribute nsIDOMEventListener onabort;
|
||||
attribute nsIDOMEventListener onerror;
|
||||
attribute nsIDOMEventListener onload;
|
||||
attribute nsIDOMEventListener onloadstart;
|
||||
attribute nsIDOMEventListener onprogress;
|
||||
attribute nsIDOMEventListener onloadend;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(cfa2d9fc-1871-444c-aaf9-8fc7fc7261d8)]
|
||||
[scriptable, builtinclass, uuid(09ff3682-7759-4441-a765-f70e1a1fabcf)]
|
||||
interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
|
||||
// for future use
|
||||
};
|
||||
@ -110,7 +110,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
|
||||
* you're aware of all the security implications. And then think twice about
|
||||
* it.
|
||||
*/
|
||||
[scriptable, uuid(10d4701f-6351-4e9b-addd-ffdba05bd425)]
|
||||
[scriptable, uuid(5cf8d518-51d0-4cd6-a69a-c3674c2de599)]
|
||||
interface nsIXMLHttpRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -374,7 +374,7 @@ interface nsIXMLHttpRequest : nsISupports
|
||||
*
|
||||
* Call open() before setting an onreadystatechange listener.
|
||||
*/
|
||||
[implicit_jscontext] attribute jsval onreadystatechange;
|
||||
attribute nsIDOMEventListener onreadystatechange;
|
||||
};
|
||||
|
||||
[scriptable, uuid(840d0d00-e83e-4a29-b3c7-67e96e90a499)]
|
||||
@ -387,7 +387,7 @@ interface nsIXHRSendable : nsISupports {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
[deprecated, scriptable, uuid(58d2c633-2efd-45be-80ed-511dcd0407cc)]
|
||||
[deprecated, scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
|
||||
interface nsIJSXMLHttpRequest : nsISupports {
|
||||
/**
|
||||
* Meant to be a script-only mechanism for setting an upload progress event
|
||||
@ -402,7 +402,7 @@ interface nsIJSXMLHttpRequest : nsISupports {
|
||||
*
|
||||
* Mozilla only.
|
||||
*/
|
||||
[implicit_jscontext] attribute jsval onuploadprogress;
|
||||
attribute nsIDOMEventListener onuploadprogress;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "nsIDOMProgressEvent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
#define ERROR_STR "error"
|
||||
#define ABORT_STR "abort"
|
||||
@ -68,17 +67,19 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(FileIOObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FileIOObject,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mProgressNotifier)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(abort)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(error)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(progress)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FileIOObject,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mProgressNotifier)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(abort)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(error)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(progress)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(FileIOObject, abort)
|
||||
NS_IMPL_EVENT_HANDLER(FileIOObject, error)
|
||||
NS_IMPL_EVENT_HANDLER(FileIOObject, progress)
|
||||
|
||||
FileIOObject::FileIOObject()
|
||||
: mProgressEventWasDelayed(PR_FALSE),
|
||||
mTimerIsActive(PR_FALSE),
|
||||
|
@ -72,9 +72,9 @@ public:
|
||||
NS_METHOD GetReadyState(PRUint16* aReadyState);
|
||||
NS_METHOD GetError(nsIDOMFileError** aError);
|
||||
|
||||
NS_DECL_EVENT_HANDLER(abort);
|
||||
NS_DECL_EVENT_HANDLER(error);
|
||||
NS_DECL_EVENT_HANDLER(progress);
|
||||
NS_DECL_AND_IMPL_EVENT_HANDLER(abort);
|
||||
NS_DECL_AND_IMPL_EVENT_HANDLER(error);
|
||||
NS_DECL_AND_IMPL_EVENT_HANDLER(progress);
|
||||
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
|
@ -96,6 +96,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMFileReader,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFile)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChannel)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(load)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(loadstart)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(loadend)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMFileReader,
|
||||
@ -103,6 +106,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMFileReader,
|
||||
tmp->mResultArrayBuffer = nsnull;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFile)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPrincipal)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(load)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(loadstart)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(loadend)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
|
@ -83,6 +83,10 @@ public:
|
||||
// nsIInterfaceRequestor
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
NS_DECL_EVENT_HANDLER(load)
|
||||
NS_DECL_EVENT_HANDLER(loadend)
|
||||
NS_DECL_EVENT_HANDLER(loadstart)
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj,
|
||||
PRUint32 argc, jsval* argv);
|
||||
|
@ -113,11 +113,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsEventSource,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChannelEventSink)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mHttpChannel)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTimer)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnOpenListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnMessageListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mUnicodeDecoder)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsEventSource, nsDOMEventTargetWrapperCache)
|
||||
tmp->Close();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnOpenListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnMessageListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
DOMCI_DATA(EventSource, nsEventSource)
|
||||
@ -156,9 +162,23 @@ nsEventSource::GetReadyState(PRInt32 *aReadyState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(nsEventSource, open)
|
||||
NS_IMPL_EVENT_HANDLER(nsEventSource, error)
|
||||
NS_IMPL_EVENT_HANDLER(nsEventSource, message)
|
||||
#define NS_EVENTSRC_IMPL_DOMEVENTLISTENER(_eventlistenername, _eventlistener) \
|
||||
NS_IMETHODIMP \
|
||||
nsEventSource::GetOn##_eventlistenername(nsIDOMEventListener * *aListener) \
|
||||
{ \
|
||||
return GetInnerEventListener(_eventlistener, aListener); \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
nsEventSource::SetOn##_eventlistenername(nsIDOMEventListener * aListener) \
|
||||
{ \
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(#_eventlistenername), \
|
||||
_eventlistener, aListener); \
|
||||
}
|
||||
|
||||
NS_EVENTSRC_IMPL_DOMEVENTLISTENER(open, mOnOpenListener)
|
||||
NS_EVENTSRC_IMPL_DOMEVENTLISTENER(error, mOnErrorListener)
|
||||
NS_EVENTSRC_IMPL_DOMEVENTLISTENER(message, mOnMessageListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventSource::Close()
|
||||
|
@ -222,6 +222,10 @@ protected:
|
||||
nsString mLastFieldName;
|
||||
nsString mLastFieldValue;
|
||||
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnOpenListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnMessageListener;
|
||||
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
|
||||
/**
|
||||
|
@ -1790,9 +1790,7 @@ GK_ATOM(svgTSpanFrame, "SVGTSpanFrame")
|
||||
GK_ATOM(svgUseFrame, "SVGUseFrame")
|
||||
GK_ATOM(HTMLVideoFrame, "VideoFrame")
|
||||
GK_ATOM(onloadstart, "onloadstart")
|
||||
GK_ATOM(onloadend, "onloadend")
|
||||
GK_ATOM(onprogress, "onprogress")
|
||||
GK_ATOM(onuploadprogress, "onuploadprogress")
|
||||
GK_ATOM(onsuspend, "onsuspend")
|
||||
GK_ATOM(onemptied, "onemptied")
|
||||
GK_ATOM(onstalled, "onstalled")
|
||||
|
@ -288,15 +288,24 @@ nsMultipartProxyListener::OnDataAvailable(nsIRequest *aRequest,
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXHREventTarget)
|
||||
|
||||
// nsXHREventTarget's CC participant doesn't actually do anything anymore
|
||||
// but these are left here as placeholders in case it needs to do something
|
||||
// in the future.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXHREventTarget,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnAbortListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadStartListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadendListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXHREventTarget,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnAbortListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadStartListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadendListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXHREventTarget)
|
||||
@ -306,12 +315,83 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_ADDREF_INHERITED(nsXHREventTarget, nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_RELEASE_INHERITED(nsXHREventTarget, nsDOMEventTargetWrapperCache)
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, load)
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, error)
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, abort)
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadstart)
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, progress)
|
||||
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadend)
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnload(nsIDOMEventListener** aOnLoad)
|
||||
{
|
||||
return GetInnerEventListener(mOnLoadListener, aOnLoad);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnload(nsIDOMEventListener* aOnLoad)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(LOAD_STR),
|
||||
mOnLoadListener, aOnLoad);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnerror(nsIDOMEventListener** aOnerror)
|
||||
{
|
||||
return GetInnerEventListener(mOnErrorListener, aOnerror);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnerror(nsIDOMEventListener* aOnerror)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(ERROR_STR),
|
||||
mOnErrorListener, aOnerror);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnabort(nsIDOMEventListener** aOnabort)
|
||||
{
|
||||
return GetInnerEventListener(mOnAbortListener, aOnabort);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnabort(nsIDOMEventListener* aOnabort)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(ABORT_STR),
|
||||
mOnAbortListener, aOnabort);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnloadstart(nsIDOMEventListener** aOnloadstart)
|
||||
{
|
||||
return GetInnerEventListener(mOnLoadStartListener, aOnloadstart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnloadstart(nsIDOMEventListener* aOnloadstart)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(LOADSTART_STR),
|
||||
mOnLoadStartListener, aOnloadstart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnprogress(nsIDOMEventListener** aOnprogress)
|
||||
{
|
||||
return GetInnerEventListener(mOnProgressListener, aOnprogress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnprogress(nsIDOMEventListener* aOnprogress)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(PROGRESS_STR),
|
||||
mOnProgressListener, aOnprogress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnloadend(nsIDOMEventListener** aOnLoadend)
|
||||
{
|
||||
return GetInnerEventListener(mOnLoadendListener, aOnLoadend);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnloadend(nsIDOMEventListener* aOnLoadend)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(LOADEND_STR),
|
||||
mOnLoadendListener, aOnLoadend);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
@ -505,6 +585,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLHttpRequest,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResponseXML)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCORSPreflightChannel)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnUploadProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnReadystatechangeListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mXMLParserStreamListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChannelEventSink)
|
||||
@ -524,6 +607,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mResponseXML)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCORSPreflightChannel)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnUploadProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnReadystatechangeListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mXMLParserStreamListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChannelEventSink)
|
||||
@ -564,8 +650,39 @@ NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
|
||||
NS_IMPL_ADDREF_INHERITED(nsXMLHttpRequest, nsXHREventTarget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsXMLHttpRequest, nsXHREventTarget)
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(nsXMLHttpRequest, readystatechange)
|
||||
NS_IMPL_EVENT_HANDLER(nsXMLHttpRequest, uploadprogress)
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetOnreadystatechange(nsIDOMEventListener * *aOnreadystatechange)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::GetInnerEventListener(mOnReadystatechangeListener,
|
||||
aOnreadystatechange);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetOnreadystatechange(nsIDOMEventListener * aOnreadystatechange)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::RemoveAddEventListener(NS_LITERAL_STRING(READYSTATE_STR),
|
||||
mOnReadystatechangeListener,
|
||||
aOnreadystatechange);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetOnuploadprogress(nsIDOMEventListener * *aOnuploadprogress)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::GetInnerEventListener(mOnUploadProgressListener,
|
||||
aOnuploadprogress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetOnuploadprogress(nsIDOMEventListener * aOnuploadprogress)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::RemoveAddEventListener(NS_LITERAL_STRING(UPLOADPROGRESS_STR),
|
||||
mOnUploadProgressListener,
|
||||
aOnuploadprogress);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIChannel channel; */
|
||||
NS_IMETHODIMP
|
||||
|
@ -80,6 +80,14 @@ public:
|
||||
nsDOMEventTargetWrapperCache)
|
||||
NS_DECL_NSIXMLHTTPREQUESTEVENTTARGET
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
|
||||
protected:
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnAbortListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadStartListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnProgressListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadendListener;
|
||||
};
|
||||
|
||||
class nsXMLHttpRequestUpload : public nsXHREventTarget,
|
||||
@ -125,7 +133,8 @@ public:
|
||||
NS_DECL_NSIXMLHTTPREQUEST
|
||||
|
||||
// nsIJSXMLHttpRequest
|
||||
NS_DECL_NSIJSXMLHTTPREQUEST
|
||||
NS_IMETHOD GetOnuploadprogress(nsIDOMEventListener** aOnuploadprogress);
|
||||
NS_IMETHOD SetOnuploadprogress(nsIDOMEventListener* aOnuploadprogress);
|
||||
|
||||
NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(nsXHREventTarget::)
|
||||
|
||||
@ -248,6 +257,9 @@ protected:
|
||||
nsCOMPtr<nsIChannel> mCORSPreflightChannel;
|
||||
nsTArray<nsCString> mCORSUnsafeHeaders;
|
||||
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnUploadProgressListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnReadystatechangeListener;
|
||||
|
||||
nsCOMPtr<nsIStreamListener> mXMLParserStreamListener;
|
||||
|
||||
// used to implement getAllResponseHeaders()
|
||||
|
Loading…
Reference in New Issue
Block a user