--- a/js/xpconnect/src/nsDOMQS.h
+++ b/js/xpconnect/src/nsDOMQS.h
@@ -26,163 +26,16 @@
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/DocumentBinding.h"
#include "mozilla/dom/SVGElementBinding.h"
#include "mozilla/dom/HTMLDocumentBinding.h"
#include "XPCQuickStubs.h"
#include "nsGlobalWindow.h"
-template<class T>
-struct ProtoIDAndDepth
-{
- enum {
- PrototypeID = mozilla::dom::prototypes::id::_ID_Count,
- Depth = -1
- };
-};
-
-#define NEW_BINDING(_native, _id) \
-template<> \
-struct ProtoIDAndDepth<_native> \
-{ \
- enum { \
- PrototypeID = mozilla::dom::prototypes::id::_id, \
- Depth = mozilla::dom::PrototypeTraits< \
- static_cast<mozilla::dom::prototypes::ID>(PrototypeID)>::Depth \
- }; \
-}
-
-NEW_BINDING(mozilla::dom::EventTarget, EventTarget);
-NEW_BINDING(nsINode, Node);
-NEW_BINDING(mozilla::dom::Element, Element);
-NEW_BINDING(nsGenericHTMLElement, HTMLElement);
-NEW_BINDING(nsIDocument, Document);
-NEW_BINDING(nsDocument, Document);
-NEW_BINDING(nsHTMLDocument, HTMLDocument);
-NEW_BINDING(nsSVGElement, SVGElement);
-NEW_BINDING(mozilla::dom::Event, Event);
-NEW_BINDING(mozilla::dom::UIEvent, UIEvent);
-NEW_BINDING(mozilla::dom::MouseEvent, MouseEvent);
-NEW_BINDING(nsGlobalWindow, Window);
-
-#define DEFINE_UNWRAP_CAST(_interface, _base, _bit) \
-namespace mozilla { \
-namespace dom { \
- \
-template <> \
-MOZ_ALWAYS_INLINE nsresult \
-UnwrapArg<_interface>(JSContext *cx, \
- JS::HandleValue v, \
- _interface **ppArg, \
- nsISupports **ppArgRef, \
- JS::MutableHandleValue vp) \
-{ \
- nsresult rv; \
- nsISupports *native = \
- castNativeArgFromWrapper(cx, v, _bit, \
- ProtoIDAndDepth<_interface>::PrototypeID, \
- ProtoIDAndDepth<_interface>::Depth, \
- ppArgRef, vp, &rv); \
- if (NS_SUCCEEDED(rv)) \
- *ppArg = static_cast<_interface*>(static_cast<_base*>(native)); \
- return rv; \
-} \
- \
-template <> \
-inline nsresult \
-UnwrapArg<_interface>(JSContext *cx, \
- JS::HandleValue v, \
- _interface **ppArg, \
- _interface **ppArgRef, \
- JS::MutableHandleValue vp) \
-{ \
- nsISupports* argRef = static_cast<_base*>(*ppArgRef); \
- nsresult rv = UnwrapArg<_interface>(cx, v, ppArg, &argRef, vp); \
- *ppArgRef = static_cast<_interface*>(static_cast<_base*>(argRef)); \
- return rv; \
-} \
- \
-} /* namespace dom */ \
-} /* namespace mozilla */
-
-#undef DOMCI_CASTABLE_INTERFACE
-
-#undef DOMCI_CASTABLE_INTERFACE
-#define DOMCI_CASTABLE_INTERFACE(_interface, _base, _bit, _extra) \
- DEFINE_UNWRAP_CAST(_interface, _base, _bit)
-
-DOMCI_CASTABLE_INTERFACES(unused)
-
-#undef DOMCI_CASTABLE_INTERFACE
-
-inline nsresult
-xpc_qsUnwrapArg_HTMLElement(JSContext *cx,
- JS::HandleValue v,
- nsIAtom *aTag,
- nsIContent **ppArg,
- nsISupports **ppArgRef,
- JS::MutableHandleValue vp)
-{
- nsGenericHTMLElement *elem;
- JS::RootedValue val(cx);
- nsresult rv =
- UnwrapArg<nsGenericHTMLElement>(cx, v, &elem, ppArgRef, &val);
- if (NS_SUCCEEDED(rv)) {
- if (elem->IsHTML(aTag)) {
- *ppArg = elem;
- vp.set(val);
- } else {
- rv = NS_ERROR_XPC_BAD_CONVERT_JS;
- }
- }
- return rv;
-}
-
-#define DEFINE_UNWRAP_CAST_HTML(_tag, _clazz) \
-namespace mozilla { \
-namespace dom { \
- \
-template <> \
-inline nsresult \
-UnwrapArg<_clazz>(JSContext *cx, \
- JS::HandleValue v, \
- _clazz **ppArg, \
- nsISupports **ppArgRef, \
- JS::MutableHandleValue vp) \
-{ \
- nsIContent *elem; \
- nsresult rv = xpc_qsUnwrapArg_HTMLElement(cx, v, nsGkAtoms::_tag, &elem, \
- ppArgRef, vp); \
- if (NS_SUCCEEDED(rv)) \
- *ppArg = static_cast<_clazz*>(elem); \
- return rv; \
-} \
- \
-template <> \
-inline nsresult \
-UnwrapArg<_clazz>(JSContext *cx, JS::HandleValue v, _clazz **ppArg, \
- _clazz **ppArgRef, JS::MutableHandleValue vp) \
-{ \
- nsISupports* argRef = static_cast<nsIContent*>(*ppArgRef); \
- nsresult rv = UnwrapArg<_clazz>(cx, v, ppArg, &argRef, vp); \
- *ppArgRef = static_cast<_clazz*>(static_cast<nsIContent*>(argRef)); \
- return rv; \
-} \
- \
-} /* namespace dom */ \
-} /* namespace mozilla */
-
-DEFINE_UNWRAP_CAST_HTML(canvas, mozilla::dom::HTMLCanvasElement)
-DEFINE_UNWRAP_CAST_HTML(form, mozilla::dom::HTMLFormElement)
-DEFINE_UNWRAP_CAST_HTML(img, mozilla::dom::HTMLImageElement)
-DEFINE_UNWRAP_CAST_HTML(optgroup, mozilla::dom::HTMLOptGroupElement)
-DEFINE_UNWRAP_CAST_HTML(option, mozilla::dom::HTMLOptionElement)
-DEFINE_UNWRAP_CAST_HTML(video, mozilla::dom::HTMLVideoElement)
-
inline nsISupports*
ToSupports(nsContentList *p)
{
return static_cast<nsINodeList*>(p);
}
inline nsISupports*
ToCanonicalSupports(nsContentList *p)