Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM MatchPattern.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_MatchPatternBinding_h
4 : #define mozilla_dom_MatchPatternBinding_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/FakeString.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/UnionMember.h"
13 :
14 : namespace mozilla {
15 :
16 : namespace dom {
17 :
18 : struct MatchPatternOptionsAtoms;
19 : struct NativePropertyHooks;
20 : class OwningStringOrMatchPattern;
21 : class ProtoAndIfaceCache;
22 :
23 : } // namespace dom
24 :
25 : namespace extensions {
26 :
27 : class MatchPattern;
28 : struct MatchPatternAtoms;
29 : class MatchPatternSet;
30 : struct MatchPatternSetAtoms;
31 :
32 : } // namespace extensions
33 :
34 : } // namespace mozilla
35 :
36 : namespace mozilla {
37 : namespace dom {
38 :
39 : void
40 : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningStringOrMatchPattern& aUnion, const char* aName, uint32_t aFlags = 0);
41 :
42 :
43 : void
44 : ImplCycleCollectionUnlink(OwningStringOrMatchPattern& aUnion);
45 :
46 :
47 : struct MatchPatternOptions : public DictionaryBase
48 : {
49 : MOZ_INIT_OUTSIDE_CTOR bool mIgnorePath;
50 :
51 : MatchPatternOptions();
52 :
53 0 : explicit inline MatchPatternOptions(const FastDictionaryInitializer& )
54 0 : {
55 : // Do nothing here; this is used by our "Fast" subclass
56 0 : }
57 :
58 : explicit inline MatchPatternOptions(const MatchPatternOptions& aOther)
59 : {
60 : *this = aOther;
61 : }
62 :
63 : bool
64 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
65 :
66 : bool
67 : Init(const nsAString& aJSON);
68 :
69 : bool
70 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
71 :
72 : bool
73 : ToJSON(nsAString& aJSON) const;
74 :
75 : void
76 : TraceDictionary(JSTracer* trc);
77 :
78 : MatchPatternOptions&
79 : operator=(const MatchPatternOptions& aOther);
80 :
81 : private:
82 : static bool
83 : InitIds(JSContext* cx, MatchPatternOptionsAtoms* atomsCache);
84 : };
85 :
86 : namespace binding_detail {
87 : struct FastMatchPatternOptions : public MatchPatternOptions
88 : {
89 0 : inline FastMatchPatternOptions()
90 0 : : MatchPatternOptions(FastDictionaryInitializer())
91 : {
92 : // Doesn't matter what int we pass to the parent constructor
93 0 : }
94 : };
95 : } // namespace binding_detail
96 :
97 :
98 : class StringOrMatchPattern
99 : {
100 : friend class StringOrMatchPatternArgument;
101 : enum Type
102 : {
103 : eUninitialized,
104 : eString,
105 : eMatchPattern
106 : };
107 :
108 : union Value
109 : {
110 : UnionMember<binding_detail::FakeString > mString;
111 : UnionMember<NonNull<mozilla::extensions::MatchPattern> > mMatchPattern;
112 :
113 : };
114 :
115 : Type mType;
116 : Value mValue;
117 :
118 : StringOrMatchPattern(const StringOrMatchPattern&) = delete;
119 : StringOrMatchPattern& operator=(const StringOrMatchPattern&) = delete;
120 : public:
121 : explicit inline StringOrMatchPattern()
122 : : mType(eUninitialized)
123 : {
124 : }
125 :
126 : inline ~StringOrMatchPattern()
127 : {
128 : Uninit();
129 : }
130 :
131 : inline binding_detail::FakeString&
132 : RawSetAsString()
133 : {
134 : if (mType == eString) {
135 : return mValue.mString.Value();
136 : }
137 : MOZ_ASSERT(mType == eUninitialized);
138 : mType = eString;
139 : return mValue.mString.SetValue();
140 : }
141 :
142 : inline binding_detail::FakeString&
143 : SetAsString()
144 : {
145 : if (mType == eString) {
146 : return mValue.mString.Value();
147 : }
148 : Uninit();
149 : mType = eString;
150 : return mValue.mString.SetValue();
151 : }
152 :
153 : inline bool
154 : IsString() const
155 : {
156 : return mType == eString;
157 : }
158 :
159 : inline binding_detail::FakeString&
160 : GetAsString()
161 : {
162 : MOZ_ASSERT(IsString(), "Wrong type!");
163 : return mValue.mString.Value();
164 : }
165 :
166 : inline const nsAString&
167 : GetAsString() const
168 : {
169 : MOZ_ASSERT(IsString(), "Wrong type!");
170 : return mValue.mString.Value();
171 : }
172 :
173 : inline NonNull<mozilla::extensions::MatchPattern>&
174 : RawSetAsMatchPattern()
175 : {
176 : if (mType == eMatchPattern) {
177 : return mValue.mMatchPattern.Value();
178 : }
179 : MOZ_ASSERT(mType == eUninitialized);
180 : mType = eMatchPattern;
181 : return mValue.mMatchPattern.SetValue();
182 : }
183 :
184 : inline NonNull<mozilla::extensions::MatchPattern>&
185 : SetAsMatchPattern()
186 : {
187 : if (mType == eMatchPattern) {
188 : return mValue.mMatchPattern.Value();
189 : }
190 : Uninit();
191 : mType = eMatchPattern;
192 : return mValue.mMatchPattern.SetValue();
193 : }
194 :
195 : inline bool
196 : IsMatchPattern() const
197 : {
198 : return mType == eMatchPattern;
199 : }
200 :
201 : inline NonNull<mozilla::extensions::MatchPattern>&
202 : GetAsMatchPattern()
203 : {
204 : MOZ_ASSERT(IsMatchPattern(), "Wrong type!");
205 : return mValue.mMatchPattern.Value();
206 : }
207 :
208 : inline mozilla::extensions::MatchPattern&
209 : GetAsMatchPattern() const
210 : {
211 : MOZ_ASSERT(IsMatchPattern(), "Wrong type!");
212 : return mValue.mMatchPattern.Value();
213 : }
214 :
215 : inline void
216 : Uninit()
217 : {
218 : switch (mType) {
219 : case eUninitialized: {
220 : break;
221 : }
222 : case eString: {
223 : DestroyString();
224 : break;
225 : }
226 : case eMatchPattern: {
227 : DestroyMatchPattern();
228 : break;
229 : }
230 : }
231 : }
232 :
233 : bool
234 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
235 :
236 : private:
237 : inline void
238 : DestroyString()
239 : {
240 : MOZ_ASSERT(IsString(), "Wrong type!");
241 : mValue.mString.Destroy();
242 : mType = eUninitialized;
243 : }
244 :
245 : inline void
246 : DestroyMatchPattern()
247 : {
248 : MOZ_ASSERT(IsMatchPattern(), "Wrong type!");
249 : mValue.mMatchPattern.Destroy();
250 : mType = eUninitialized;
251 : }
252 : };
253 :
254 :
255 : class OwningStringOrMatchPattern : public AllOwningUnionBase
256 : {
257 : friend void ImplCycleCollectionUnlink(OwningStringOrMatchPattern& aUnion);
258 : enum Type
259 : {
260 : eUninitialized,
261 : eString,
262 : eMatchPattern
263 : };
264 :
265 0 : union Value
266 : {
267 : UnionMember<nsString > mString;
268 : UnionMember<OwningNonNull<mozilla::extensions::MatchPattern> > mMatchPattern;
269 :
270 : };
271 :
272 : Type mType;
273 : Value mValue;
274 :
275 : public:
276 0 : explicit inline OwningStringOrMatchPattern()
277 0 : : mType(eUninitialized)
278 : {
279 0 : }
280 :
281 : explicit inline OwningStringOrMatchPattern(const OwningStringOrMatchPattern& aOther)
282 : : mType(eUninitialized)
283 : {
284 : *this = aOther;
285 : }
286 :
287 0 : inline ~OwningStringOrMatchPattern()
288 0 : {
289 0 : Uninit();
290 0 : }
291 :
292 : nsString&
293 : RawSetAsString();
294 :
295 : nsString&
296 : SetAsString();
297 :
298 : bool
299 : TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
300 :
301 : inline void
302 : SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
303 : {
304 : RawSetAsString().Assign(aData, aLength);
305 : }
306 :
307 : inline bool
308 0 : IsString() const
309 : {
310 0 : return mType == eString;
311 : }
312 :
313 : inline nsString&
314 : GetAsString()
315 : {
316 : MOZ_ASSERT(IsString(), "Wrong type!");
317 : return mValue.mString.Value();
318 : }
319 :
320 : inline nsString const &
321 0 : GetAsString() const
322 : {
323 0 : MOZ_ASSERT(IsString(), "Wrong type!");
324 0 : return mValue.mString.Value();
325 : }
326 :
327 : OwningNonNull<mozilla::extensions::MatchPattern>&
328 : RawSetAsMatchPattern();
329 :
330 : OwningNonNull<mozilla::extensions::MatchPattern>&
331 : SetAsMatchPattern();
332 :
333 : bool
334 : TrySetToMatchPattern(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
335 :
336 : inline bool
337 0 : IsMatchPattern() const
338 : {
339 0 : return mType == eMatchPattern;
340 : }
341 :
342 : inline OwningNonNull<mozilla::extensions::MatchPattern>&
343 0 : GetAsMatchPattern()
344 : {
345 0 : MOZ_ASSERT(IsMatchPattern(), "Wrong type!");
346 0 : return mValue.mMatchPattern.Value();
347 : }
348 :
349 : inline OwningNonNull<mozilla::extensions::MatchPattern> const &
350 0 : GetAsMatchPattern() const
351 : {
352 0 : MOZ_ASSERT(IsMatchPattern(), "Wrong type!");
353 0 : return mValue.mMatchPattern.Value();
354 : }
355 :
356 : void
357 : Uninit();
358 :
359 : bool
360 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
361 :
362 : void
363 : TraceUnion(JSTracer* trc);
364 :
365 : OwningStringOrMatchPattern&
366 : operator=(const OwningStringOrMatchPattern& aOther);
367 :
368 : private:
369 : void
370 : DestroyString();
371 :
372 : void
373 : DestroyMatchPattern();
374 : };
375 :
376 :
377 : namespace MatchPatternBinding {
378 :
379 : typedef mozilla::extensions::MatchPattern NativeType;
380 :
381 : bool
382 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
383 :
384 : JSObject*
385 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
386 :
387 : const JSClass*
388 : GetJSClass();
389 :
390 : bool
391 : Wrap(JSContext* aCx, mozilla::extensions::MatchPattern* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
392 :
393 : template <class T>
394 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
395 : {
396 0 : JS::Rooted<JSObject*> reflector(aCx);
397 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
398 : }
399 :
400 : // We declare this as an array so that retrieving a pointer to this
401 : // binding's property hooks only requires compile/link-time resolvable
402 : // address arithmetic. Declaring it as a pointer instead would require
403 : // doing a run-time load to fetch a pointer to this binding's property
404 : // hooks. And then structures which embedded a pointer to this structure
405 : // would require a run-time load for proper initialization, which would
406 : // then induce static constructors. Lots of static constructors.
407 : extern const NativePropertyHooks sNativePropertyHooks[];
408 :
409 : void
410 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
411 :
412 : JS::Handle<JSObject*>
413 : GetProtoObjectHandle(JSContext* aCx);
414 :
415 : JS::Handle<JSObject*>
416 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
417 :
418 : JSObject*
419 : GetConstructorObject(JSContext* aCx);
420 :
421 : } // namespace MatchPatternBinding
422 :
423 :
424 :
425 : namespace MatchPatternSetBinding {
426 :
427 : typedef mozilla::extensions::MatchPatternSet NativeType;
428 :
429 : bool
430 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
431 :
432 : JSObject*
433 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
434 :
435 : const JSClass*
436 : GetJSClass();
437 :
438 : bool
439 : Wrap(JSContext* aCx, mozilla::extensions::MatchPatternSet* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
440 :
441 : template <class T>
442 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
443 : {
444 0 : JS::Rooted<JSObject*> reflector(aCx);
445 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
446 : }
447 :
448 : // We declare this as an array so that retrieving a pointer to this
449 : // binding's property hooks only requires compile/link-time resolvable
450 : // address arithmetic. Declaring it as a pointer instead would require
451 : // doing a run-time load to fetch a pointer to this binding's property
452 : // hooks. And then structures which embedded a pointer to this structure
453 : // would require a run-time load for proper initialization, which would
454 : // then induce static constructors. Lots of static constructors.
455 : extern const NativePropertyHooks sNativePropertyHooks[];
456 :
457 : void
458 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
459 :
460 : JS::Handle<JSObject*>
461 : GetProtoObjectHandle(JSContext* aCx);
462 :
463 : JS::Handle<JSObject*>
464 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
465 :
466 : JSObject*
467 : GetConstructorObject(JSContext* aCx);
468 :
469 : } // namespace MatchPatternSetBinding
470 :
471 :
472 :
473 : } // namespace dom
474 : } // namespace mozilla
475 :
476 : #endif // mozilla_dom_MatchPatternBinding_h
|