Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM PushSubscription.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_PushSubscriptionBinding_h
4 : #define mozilla_dom_PushSubscriptionBinding_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 : #include "mozilla/dom/TypedArray.h"
12 : #include "mozilla/dom/UnionTypes.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class ArrayBufferViewOrArrayBuffer;
18 : struct NativePropertyHooks;
19 : class OwningArrayBufferViewOrArrayBuffer;
20 : class ProtoAndIfaceCache;
21 : class PushSubscription;
22 : struct PushSubscriptionAtoms;
23 : struct PushSubscriptionInitAtoms;
24 : struct PushSubscriptionJSONAtoms;
25 : struct PushSubscriptionKeys;
26 : struct PushSubscriptionKeysAtoms;
27 :
28 : } // namespace dom
29 : } // namespace mozilla
30 :
31 : namespace mozilla {
32 : namespace dom {
33 :
34 : enum class PushEncryptionKeyName : uint8_t {
35 : P256dh,
36 : Auth,
37 : EndGuard_
38 : };
39 :
40 : namespace PushEncryptionKeyNameValues {
41 : extern const EnumEntry strings[3];
42 : } // namespace PushEncryptionKeyNameValues
43 :
44 : bool
45 : ToJSValue(JSContext* aCx, PushEncryptionKeyName aArgument, JS::MutableHandle<JS::Value> aValue);
46 :
47 :
48 0 : struct PushSubscriptionInit : public DictionaryBase
49 : {
50 : MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<OwningArrayBufferViewOrArrayBuffer >> mAppServerKey;
51 : MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<ArrayBuffer>> mAuthSecret;
52 : MOZ_INIT_OUTSIDE_CTOR nsString mEndpoint;
53 : MOZ_INIT_OUTSIDE_CTOR Optional<Nullable<ArrayBuffer>> mP256dhKey;
54 : MOZ_INIT_OUTSIDE_CTOR nsString mScope;
55 :
56 : PushSubscriptionInit();
57 :
58 0 : explicit inline PushSubscriptionInit(const FastDictionaryInitializer& )
59 0 : {
60 : // Do nothing here; this is used by our "Fast" subclass
61 0 : }
62 :
63 : private:
64 : PushSubscriptionInit(const PushSubscriptionInit&) = delete;
65 : PushSubscriptionInit& operator=(const PushSubscriptionInit&) = delete;
66 :
67 : static bool
68 : InitIds(JSContext* cx, PushSubscriptionInitAtoms* atomsCache);
69 :
70 : public:
71 : bool
72 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
73 :
74 : bool
75 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
76 :
77 : void
78 : TraceDictionary(JSTracer* trc);
79 : };
80 :
81 : namespace binding_detail {
82 0 : struct FastPushSubscriptionInit : public PushSubscriptionInit
83 : {
84 0 : inline FastPushSubscriptionInit()
85 0 : : PushSubscriptionInit(FastDictionaryInitializer())
86 : {
87 : // Doesn't matter what int we pass to the parent constructor
88 0 : }
89 : };
90 : } // namespace binding_detail
91 :
92 :
93 0 : struct PushSubscriptionKeys : public DictionaryBase
94 : {
95 : MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mAuth;
96 : MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mP256dh;
97 :
98 : PushSubscriptionKeys();
99 :
100 0 : explicit inline PushSubscriptionKeys(const FastDictionaryInitializer& )
101 0 : {
102 : // Do nothing here; this is used by our "Fast" subclass
103 0 : }
104 :
105 : explicit inline PushSubscriptionKeys(const PushSubscriptionKeys& aOther)
106 : {
107 : *this = aOther;
108 : }
109 :
110 : bool
111 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
112 :
113 : bool
114 : Init(const nsAString& aJSON);
115 :
116 : bool
117 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
118 :
119 : bool
120 : ToJSON(nsAString& aJSON) const;
121 :
122 : void
123 : TraceDictionary(JSTracer* trc);
124 :
125 : PushSubscriptionKeys&
126 : operator=(const PushSubscriptionKeys& aOther);
127 :
128 : private:
129 : static bool
130 : InitIds(JSContext* cx, PushSubscriptionKeysAtoms* atomsCache);
131 : };
132 :
133 : namespace binding_detail {
134 : struct FastPushSubscriptionKeys : public PushSubscriptionKeys
135 : {
136 : inline FastPushSubscriptionKeys()
137 : : PushSubscriptionKeys(FastDictionaryInitializer())
138 : {
139 : // Doesn't matter what int we pass to the parent constructor
140 : }
141 : };
142 : } // namespace binding_detail
143 :
144 :
145 0 : struct PushSubscriptionJSON : public DictionaryBase
146 : {
147 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mEndpoint;
148 : MOZ_INIT_OUTSIDE_CTOR PushSubscriptionKeys mKeys;
149 :
150 : PushSubscriptionJSON();
151 :
152 : explicit inline PushSubscriptionJSON(const FastDictionaryInitializer& )
153 : : mKeys(FastDictionaryInitializer())
154 : {
155 : // Do nothing here; this is used by our "Fast" subclass
156 : }
157 :
158 : explicit inline PushSubscriptionJSON(const PushSubscriptionJSON& aOther)
159 : : mKeys(FastDictionaryInitializer())
160 : {
161 : *this = aOther;
162 : }
163 :
164 : bool
165 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
166 :
167 : bool
168 : Init(const nsAString& aJSON);
169 :
170 : bool
171 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
172 :
173 : bool
174 : ToJSON(nsAString& aJSON) const;
175 :
176 : void
177 : TraceDictionary(JSTracer* trc);
178 :
179 : PushSubscriptionJSON&
180 : operator=(const PushSubscriptionJSON& aOther);
181 :
182 : private:
183 : static bool
184 : InitIds(JSContext* cx, PushSubscriptionJSONAtoms* atomsCache);
185 : };
186 :
187 : namespace binding_detail {
188 : struct FastPushSubscriptionJSON : public PushSubscriptionJSON
189 : {
190 : inline FastPushSubscriptionJSON()
191 : : PushSubscriptionJSON(FastDictionaryInitializer())
192 : {
193 : // Doesn't matter what int we pass to the parent constructor
194 : }
195 : };
196 : } // namespace binding_detail
197 :
198 :
199 : namespace PushSubscriptionBinding {
200 :
201 : typedef mozilla::dom::PushSubscription NativeType;
202 :
203 : bool
204 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
205 :
206 : JSObject*
207 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
208 :
209 : const JSClass*
210 : GetJSClass();
211 :
212 : bool
213 : Wrap(JSContext* aCx, mozilla::dom::PushSubscription* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
214 :
215 : template <class T>
216 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
217 : {
218 0 : JS::Rooted<JSObject*> reflector(aCx);
219 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
220 : }
221 :
222 : // We declare this as an array so that retrieving a pointer to this
223 : // binding's property hooks only requires compile/link-time resolvable
224 : // address arithmetic. Declaring it as a pointer instead would require
225 : // doing a run-time load to fetch a pointer to this binding's property
226 : // hooks. And then structures which embedded a pointer to this structure
227 : // would require a run-time load for proper initialization, which would
228 : // then induce static constructors. Lots of static constructors.
229 : extern const NativePropertyHooks sNativePropertyHooks[];
230 :
231 : void
232 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
233 :
234 : JS::Handle<JSObject*>
235 : GetProtoObjectHandle(JSContext* aCx);
236 :
237 : JS::Handle<JSObject*>
238 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
239 :
240 : JSObject*
241 : GetConstructorObject(JSContext* aCx);
242 :
243 : } // namespace PushSubscriptionBinding
244 :
245 :
246 :
247 : } // namespace dom
248 : } // namespace mozilla
249 :
250 : #endif // mozilla_dom_PushSubscriptionBinding_h
|