Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM XMLHttpRequest.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_XMLHttpRequestBinding_h
4 : #define mozilla_dom_XMLHttpRequestBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/Nullable.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : struct MozXMLHttpRequestParametersAtoms;
16 : struct NativePropertyHooks;
17 : class ProtoAndIfaceCache;
18 : class XMLHttpRequest;
19 : struct XMLHttpRequestAtoms;
20 :
21 : } // namespace dom
22 : } // namespace mozilla
23 :
24 : namespace mozilla {
25 : namespace dom {
26 :
27 : enum class XMLHttpRequestResponseType : uint8_t {
28 : _empty,
29 : Arraybuffer,
30 : Blob,
31 : Document,
32 : Json,
33 : Text,
34 : Moz_chunked_text,
35 : Moz_chunked_arraybuffer,
36 : Moz_blob,
37 : EndGuard_
38 : };
39 :
40 : namespace XMLHttpRequestResponseTypeValues {
41 : extern const EnumEntry strings[10];
42 : } // namespace XMLHttpRequestResponseTypeValues
43 :
44 : bool
45 : ToJSValue(JSContext* aCx, XMLHttpRequestResponseType aArgument, JS::MutableHandle<JS::Value> aValue);
46 :
47 :
48 : struct MozXMLHttpRequestParameters : public DictionaryBase
49 : {
50 : MOZ_INIT_OUTSIDE_CTOR bool mMozAnon;
51 : MOZ_INIT_OUTSIDE_CTOR bool mMozSystem;
52 :
53 : MozXMLHttpRequestParameters();
54 :
55 3 : explicit inline MozXMLHttpRequestParameters(const FastDictionaryInitializer& )
56 3 : {
57 : // Do nothing here; this is used by our "Fast" subclass
58 3 : }
59 :
60 : explicit inline MozXMLHttpRequestParameters(const MozXMLHttpRequestParameters& aOther)
61 : {
62 : *this = aOther;
63 : }
64 :
65 : bool
66 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
67 :
68 : bool
69 : Init(const nsAString& aJSON);
70 :
71 : bool
72 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
73 :
74 : bool
75 : ToJSON(nsAString& aJSON) const;
76 :
77 : void
78 : TraceDictionary(JSTracer* trc);
79 :
80 : MozXMLHttpRequestParameters&
81 : operator=(const MozXMLHttpRequestParameters& aOther);
82 :
83 : private:
84 : static bool
85 : InitIds(JSContext* cx, MozXMLHttpRequestParametersAtoms* atomsCache);
86 : };
87 :
88 : namespace binding_detail {
89 : struct FastMozXMLHttpRequestParameters : public MozXMLHttpRequestParameters
90 : {
91 3 : inline FastMozXMLHttpRequestParameters()
92 3 : : MozXMLHttpRequestParameters(FastDictionaryInitializer())
93 : {
94 : // Doesn't matter what int we pass to the parent constructor
95 3 : }
96 : };
97 : } // namespace binding_detail
98 :
99 :
100 : namespace XMLHttpRequestBinding {
101 :
102 : typedef mozilla::dom::XMLHttpRequest NativeType;
103 :
104 : bool
105 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
106 :
107 : JSObject*
108 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
109 :
110 : const JSClass*
111 : GetJSClass();
112 :
113 : bool
114 : Wrap(JSContext* aCx, mozilla::dom::XMLHttpRequest* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
115 :
116 : template <class T>
117 6 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
118 : {
119 12 : JS::Rooted<JSObject*> reflector(aCx);
120 12 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
121 : }
122 :
123 : // We declare this as an array so that retrieving a pointer to this
124 : // binding's property hooks only requires compile/link-time resolvable
125 : // address arithmetic. Declaring it as a pointer instead would require
126 : // doing a run-time load to fetch a pointer to this binding's property
127 : // hooks. And then structures which embedded a pointer to this structure
128 : // would require a run-time load for proper initialization, which would
129 : // then induce static constructors. Lots of static constructors.
130 : extern const NativePropertyHooks sNativePropertyHooks[];
131 :
132 : void
133 : ClearCachedResponseTextValue(mozilla::dom::XMLHttpRequest* aObject);
134 :
135 : void
136 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
137 :
138 : JS::Handle<JSObject*>
139 : GetProtoObjectHandle(JSContext* aCx);
140 :
141 : JS::Handle<JSObject*>
142 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
143 :
144 : JSObject*
145 : GetConstructorObject(JSContext* aCx);
146 :
147 : } // namespace XMLHttpRequestBinding
148 :
149 :
150 :
151 : } // namespace dom
152 : } // namespace mozilla
153 :
154 : #endif // mozilla_dom_XMLHttpRequestBinding_h
|