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