/work/obj-fuzz/dist/include/mozilla/dom/CacheBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM Cache.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_CacheBinding_h |
4 | | #define mozilla_dom_CacheBinding_h |
5 | | |
6 | | #include "GeckoProfiler.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 | | #include "mozilla/dom/PrototypeList.h" |
13 | | #include "mozilla/dom/Request.h" |
14 | | #include "mozilla/dom/Response.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | struct CacheBatchOperationAtoms; |
20 | | struct CacheQueryOptions; |
21 | | struct CacheQueryOptionsAtoms; |
22 | | struct NativePropertyHooks; |
23 | | class ProtoAndIfaceCache; |
24 | | class Request; |
25 | | class Response; |
26 | | |
27 | | namespace cache { |
28 | | |
29 | | class Cache; |
30 | | struct CacheAtoms; |
31 | | |
32 | | } // namespace cache |
33 | | |
34 | | } // namespace dom |
35 | | } // namespace mozilla |
36 | | |
37 | | namespace mozilla { |
38 | | namespace dom { |
39 | | |
40 | | struct CacheQueryOptions : public DictionaryBase |
41 | | { |
42 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCacheName; |
43 | | MOZ_INIT_OUTSIDE_CTOR bool mIgnoreMethod; |
44 | | MOZ_INIT_OUTSIDE_CTOR bool mIgnoreSearch; |
45 | | MOZ_INIT_OUTSIDE_CTOR bool mIgnoreVary; |
46 | | |
47 | | CacheQueryOptions(); |
48 | | |
49 | | explicit inline CacheQueryOptions(const FastDictionaryInitializer& ) |
50 | 0 | { |
51 | 0 | // Do nothing here; this is used by our "Fast" subclass |
52 | 0 | } |
53 | | |
54 | | explicit inline CacheQueryOptions(const CacheQueryOptions& aOther) |
55 | 0 | { |
56 | 0 | *this = aOther; |
57 | 0 | } |
58 | | |
59 | | bool |
60 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
61 | | |
62 | | bool |
63 | | Init(const nsAString& aJSON); |
64 | | |
65 | | bool |
66 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
67 | | |
68 | | bool |
69 | | ToJSON(nsAString& aJSON) const; |
70 | | |
71 | | void |
72 | | TraceDictionary(JSTracer* trc); |
73 | | |
74 | | CacheQueryOptions& |
75 | | operator=(const CacheQueryOptions& aOther); |
76 | | |
77 | | private: |
78 | | static bool |
79 | | InitIds(JSContext* cx, CacheQueryOptionsAtoms* atomsCache); |
80 | | }; |
81 | | |
82 | | namespace binding_detail { |
83 | | struct FastCacheQueryOptions : public CacheQueryOptions |
84 | | { |
85 | | inline FastCacheQueryOptions() |
86 | | : CacheQueryOptions(FastDictionaryInitializer()) |
87 | 0 | { |
88 | 0 | // Doesn't matter what int we pass to the parent constructor |
89 | 0 | } |
90 | | }; |
91 | | } // namespace binding_detail |
92 | | |
93 | | |
94 | | struct CacheBatchOperation : public DictionaryBase |
95 | | { |
96 | | MOZ_INIT_OUTSIDE_CTOR CacheQueryOptions mOptions; |
97 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::dom::Request>> mRequest; |
98 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::dom::Response>> mResponse; |
99 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mType; |
100 | | |
101 | | CacheBatchOperation(); |
102 | | |
103 | | explicit inline CacheBatchOperation(const FastDictionaryInitializer& ) |
104 | | : mOptions(FastDictionaryInitializer()) |
105 | 0 | { |
106 | 0 | // Do nothing here; this is used by our "Fast" subclass |
107 | 0 | } |
108 | | |
109 | | explicit inline CacheBatchOperation(const CacheBatchOperation& aOther) |
110 | | : mOptions(FastDictionaryInitializer()) |
111 | 0 | { |
112 | 0 | *this = aOther; |
113 | 0 | } |
114 | | |
115 | | bool |
116 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
117 | | |
118 | | bool |
119 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
120 | | |
121 | | void |
122 | | TraceDictionary(JSTracer* trc); |
123 | | |
124 | | inline void |
125 | | TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags) |
126 | 0 | { |
127 | 0 | ImplCycleCollectionTraverse(aCallback, mRequest, "mRequest", aFlags); |
128 | 0 | ImplCycleCollectionTraverse(aCallback, mResponse, "mResponse", aFlags); |
129 | 0 | } |
130 | | |
131 | | inline void |
132 | | UnlinkForCC() |
133 | 0 | { |
134 | 0 | ImplCycleCollectionUnlink(mRequest); |
135 | 0 | ImplCycleCollectionUnlink(mResponse); |
136 | 0 | } |
137 | | |
138 | | CacheBatchOperation& |
139 | | operator=(const CacheBatchOperation& aOther); |
140 | | |
141 | | private: |
142 | | static bool |
143 | | InitIds(JSContext* cx, CacheBatchOperationAtoms* atomsCache); |
144 | | }; |
145 | | |
146 | | namespace binding_detail { |
147 | | struct FastCacheBatchOperation : public CacheBatchOperation |
148 | | { |
149 | | inline FastCacheBatchOperation() |
150 | | : CacheBatchOperation(FastDictionaryInitializer()) |
151 | 0 | { |
152 | 0 | // Doesn't matter what int we pass to the parent constructor |
153 | 0 | } |
154 | | }; |
155 | | } // namespace binding_detail |
156 | | |
157 | | |
158 | | namespace Cache_Binding { |
159 | | |
160 | | typedef mozilla::dom::cache::Cache NativeType; |
161 | | |
162 | | bool |
163 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
164 | | |
165 | | const JSClass* |
166 | | GetJSClass(); |
167 | | |
168 | | bool |
169 | | Wrap(JSContext* aCx, mozilla::dom::cache::Cache* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
170 | | |
171 | | template <class T> |
172 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
173 | 0 | { |
174 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
175 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
176 | 0 | } |
177 | | |
178 | | // We declare this as an array so that retrieving a pointer to this |
179 | | // binding's property hooks only requires compile/link-time resolvable |
180 | | // address arithmetic. Declaring it as a pointer instead would require |
181 | | // doing a run-time load to fetch a pointer to this binding's property |
182 | | // hooks. And then structures which embedded a pointer to this structure |
183 | | // would require a run-time load for proper initialization, which would |
184 | | // then induce static constructors. Lots of static constructors. |
185 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
186 | | |
187 | | void |
188 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
189 | | |
190 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
191 | 0 | { |
192 | 0 | /* Get the interface prototype object for this class. This will create the |
193 | 0 | object as needed. */ |
194 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::Cache, |
195 | 0 | &CreateInterfaceObjects, |
196 | 0 | /* aDefineOnGlobal = */ true); |
197 | 0 |
|
198 | 0 | } |
199 | | |
200 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
201 | 0 | { |
202 | 0 | /* Get the interface object for this class. This will create the object as |
203 | 0 | needed. */ |
204 | 0 |
|
205 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::Cache, |
206 | 0 | &CreateInterfaceObjects, |
207 | 0 | aDefineOnGlobal); |
208 | 0 | } |
209 | | |
210 | | JSObject* |
211 | | GetConstructorObject(JSContext* aCx); |
212 | | |
213 | | } // namespace Cache_Binding |
214 | | |
215 | | |
216 | | |
217 | | } // namespace dom |
218 | | } // namespace mozilla |
219 | | |
220 | | #endif // mozilla_dom_CacheBinding_h |