Merge m-c to fx-team.
[gecko.git] / dom / workers / XMLHttpRequestEventTarget.h
blob777746e1cd9a62297ed2cae0d9c70873a3e9031c
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_workers_xmlhttprequesteventtarget_h__
7 #define mozilla_dom_workers_xmlhttprequesteventtarget_h__
9 #include "mozilla/dom/workers/bindings/EventTarget.h"
11 BEGIN_WORKERS_NAMESPACE
13 class XMLHttpRequestEventTarget : public EventTarget
15 protected:
16 XMLHttpRequestEventTarget(JSContext* aCx)
17 : EventTarget(aCx)
18 { }
20 virtual ~XMLHttpRequestEventTarget()
21 { }
23 public:
24 virtual void
25 _trace(JSTracer* aTrc) MOZ_OVERRIDE;
27 virtual void
28 _finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
30 #define IMPL_GETTER_AND_SETTER(_type) \
31 JSObject* \
32 GetOn##_type(JSContext* /* unused */, ErrorResult& aRv) \
33 { \
34 return GetEventListener(NS_LITERAL_STRING(#_type), aRv); \
35 } \
37 void \
38 SetOn##_type(JSContext* /* unused */, JS::Handle<JSObject*> aListener, \
39 ErrorResult& aRv) \
40 { \
41 SetEventListener(NS_LITERAL_STRING(#_type), aListener, aRv); \
44 IMPL_GETTER_AND_SETTER(loadstart)
45 IMPL_GETTER_AND_SETTER(progress)
46 IMPL_GETTER_AND_SETTER(abort)
47 IMPL_GETTER_AND_SETTER(error)
48 IMPL_GETTER_AND_SETTER(load)
49 IMPL_GETTER_AND_SETTER(timeout)
50 IMPL_GETTER_AND_SETTER(loadend)
52 #undef IMPL_GETTER_AND_SETTER
55 END_WORKERS_NAMESPACE
57 #endif // mozilla_dom_workers_xmlhttprequesteventtarget_h__