/work/obj-fuzz/dom/bindings/URLSearchParamsBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM URLSearchParams.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "URLSearchParamsBinding.h" |
4 | | #include "WrapperFactory.h" |
5 | | #include "mozilla/OwningNonNull.h" |
6 | | #include "mozilla/dom/BindingUtils.h" |
7 | | #include "mozilla/dom/DOMJSClass.h" |
8 | | #include "mozilla/dom/IterableIterator.h" |
9 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
10 | | #include "mozilla/dom/Nullable.h" |
11 | | #include "mozilla/dom/PrimitiveConversions.h" |
12 | | #include "mozilla/dom/ToJSValue.h" |
13 | | #include "mozilla/dom/URLSearchParams.h" |
14 | | #include "mozilla/dom/UnionConversions.h" |
15 | | #include "mozilla/dom/XrayExpandoClass.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
21 | | using namespace mozilla::dom::binding_detail; |
22 | | |
23 | | |
24 | | bool |
25 | | USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const |
26 | 0 | { |
27 | 0 | switch (mType) { |
28 | 0 | case eUninitialized: { |
29 | 0 | return false; |
30 | 0 | break; |
31 | 0 | } |
32 | 0 | case eUSVStringSequenceSequence: { |
33 | 0 |
|
34 | 0 | uint32_t length = mValue.mUSVStringSequenceSequence.Value().Length(); |
35 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
36 | 0 | if (!returnArray) { |
37 | 0 | return false; |
38 | 0 | } |
39 | 0 | // Scope for 'tmp' |
40 | 0 | { |
41 | 0 | JS::Rooted<JS::Value> tmp(cx); |
42 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
43 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
44 | 0 | // are different ways to succeed at wrapping the object. |
45 | 0 | do { |
46 | 0 |
|
47 | 0 | uint32_t length = mValue.mUSVStringSequenceSequence.Value()[sequenceIdx0].Length(); |
48 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
49 | 0 | if (!returnArray) { |
50 | 0 | return false; |
51 | 0 | } |
52 | 0 | // Scope for 'tmp' |
53 | 0 | { |
54 | 0 | JS::Rooted<JS::Value> tmp(cx); |
55 | 0 | for (uint32_t sequenceIdx1 = 0; sequenceIdx1 < length; ++sequenceIdx1) { |
56 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
57 | 0 | // are different ways to succeed at wrapping the object. |
58 | 0 | do { |
59 | 0 | if (!xpc::NonVoidStringToJsval(cx, mValue.mUSVStringSequenceSequence.Value()[sequenceIdx0][sequenceIdx1], &tmp)) { |
60 | 0 | return false; |
61 | 0 | } |
62 | 0 | break; |
63 | 0 | } while (false); |
64 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx1, tmp, |
65 | 0 | JSPROP_ENUMERATE)) { |
66 | 0 | return false; |
67 | 0 | } |
68 | 0 | } |
69 | 0 | } |
70 | 0 | tmp.setObject(*returnArray); |
71 | 0 | break; |
72 | 0 | } while (false); |
73 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
74 | 0 | JSPROP_ENUMERATE)) { |
75 | 0 | return false; |
76 | 0 | } |
77 | 0 | } |
78 | 0 | } |
79 | 0 | rval.setObject(*returnArray); |
80 | 0 | return true; |
81 | 0 | break; |
82 | 0 | } |
83 | 0 | case eUSVStringUSVStringRecord: { |
84 | 0 |
|
85 | 0 | JS::Rooted<JSObject*> returnObj(cx, JS_NewPlainObject(cx)); |
86 | 0 | if (!returnObj) { |
87 | 0 | return false; |
88 | 0 | } |
89 | 0 | // Scope for 'tmp' |
90 | 0 | { |
91 | 0 | JS::Rooted<JS::Value> tmp(cx); |
92 | 0 | for (auto& entry : mValue.mUSVStringUSVStringRecord.Value().Entries()) { |
93 | 0 | auto& recordValue0 = entry.mValue; |
94 | 0 | // Control block to let us common up the JS_DefineUCProperty calls when there |
95 | 0 | // are different ways to succeed at wrapping the value. |
96 | 0 | do { |
97 | 0 | if (!xpc::NonVoidStringToJsval(cx, recordValue0, &tmp)) { |
98 | 0 | return false; |
99 | 0 | } |
100 | 0 | break; |
101 | 0 | } while (false); |
102 | 0 | if (!JS_DefineUCProperty(cx, returnObj, |
103 | 0 | entry.mKey.BeginReading(), |
104 | 0 | entry.mKey.Length(), tmp, |
105 | 0 | JSPROP_ENUMERATE)) { |
106 | 0 | return false; |
107 | 0 | } |
108 | 0 | } |
109 | 0 | } |
110 | 0 | rval.setObject(*returnObj); |
111 | 0 | return true; |
112 | 0 | break; |
113 | 0 | } |
114 | 0 | case eUSVString: { |
115 | 0 | if (!xpc::NonVoidStringToJsval(cx, mValue.mUSVString.Value(), rval)) { |
116 | 0 | return false; |
117 | 0 | } |
118 | 0 | return true; |
119 | 0 | break; |
120 | 0 | } |
121 | 0 | default: { |
122 | 0 | return false; |
123 | 0 | break; |
124 | 0 | } |
125 | 0 | } |
126 | 0 | |
127 | 0 | return false; |
128 | 0 | } |
129 | | |
130 | | |
131 | | Sequence<Sequence<nsString>>& |
132 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::RawSetAsUSVStringSequenceSequence() |
133 | 0 | { |
134 | 0 | if (mType == eUSVStringSequenceSequence) { |
135 | 0 | return mValue.mUSVStringSequenceSequence.Value(); |
136 | 0 | } |
137 | 0 | MOZ_ASSERT(mType == eUninitialized); |
138 | 0 | mType = eUSVStringSequenceSequence; |
139 | 0 | return mValue.mUSVStringSequenceSequence.SetValue(); |
140 | 0 | } |
141 | | |
142 | | Sequence<Sequence<nsString>>& |
143 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::SetAsUSVStringSequenceSequence() |
144 | 0 | { |
145 | 0 | if (mType == eUSVStringSequenceSequence) { |
146 | 0 | return mValue.mUSVStringSequenceSequence.Value(); |
147 | 0 | } |
148 | 0 | Uninit(); |
149 | 0 | mType = eUSVStringSequenceSequence; |
150 | 0 | return mValue.mUSVStringSequenceSequence.SetValue(); |
151 | 0 | } |
152 | | |
153 | | bool |
154 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::TrySetToUSVStringSequenceSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl) |
155 | 0 | { |
156 | 0 | tryNext = false; |
157 | 0 | { // scope for memberSlot |
158 | 0 | Sequence<Sequence<nsString>>& memberSlot = RawSetAsUSVStringSequenceSequence(); |
159 | 0 | JS::ForOfIterator iter(cx); |
160 | 0 | if (!iter.init(value, JS::ForOfIterator::AllowNonIterable)) { |
161 | 0 | return false; |
162 | 0 | } |
163 | 0 | if (!iter.valueIsIterable()) { |
164 | 0 | DestroyUSVStringSequenceSequence(); |
165 | 0 | tryNext = true; |
166 | 0 | return true; |
167 | 0 | } |
168 | 0 | Sequence<Sequence<nsString>> &arr = memberSlot; |
169 | 0 | JS::Rooted<JS::Value> temp(cx); |
170 | 0 | while (true) { |
171 | 0 | bool done; |
172 | 0 | if (!iter.next(&temp, &done)) { |
173 | 0 | return false; |
174 | 0 | } |
175 | 0 | if (done) { |
176 | 0 | break; |
177 | 0 | } |
178 | 0 | Sequence<nsString>* slotPtr = arr.AppendElement(mozilla::fallible); |
179 | 0 | if (!slotPtr) { |
180 | 0 | JS_ReportOutOfMemory(cx); |
181 | 0 | return false; |
182 | 0 | } |
183 | 0 | Sequence<nsString>& slot = *slotPtr; |
184 | 0 | if (temp.isObject()) { |
185 | 0 | JS::ForOfIterator iter1(cx); |
186 | 0 | if (!iter1.init(temp, JS::ForOfIterator::AllowNonIterable)) { |
187 | 0 | return false; |
188 | 0 | } |
189 | 0 | if (!iter1.valueIsIterable()) { |
190 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Element of member of USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString"); |
191 | 0 | return false; |
192 | 0 | } |
193 | 0 | Sequence<nsString> &arr1 = slot; |
194 | 0 | JS::Rooted<JS::Value> temp1(cx); |
195 | 0 | while (true) { |
196 | 0 | bool done1; |
197 | 0 | if (!iter1.next(&temp1, &done1)) { |
198 | 0 | return false; |
199 | 0 | } |
200 | 0 | if (done1) { |
201 | 0 | break; |
202 | 0 | } |
203 | 0 | nsString* slotPtr1 = arr1.AppendElement(mozilla::fallible); |
204 | 0 | if (!slotPtr1) { |
205 | 0 | JS_ReportOutOfMemory(cx); |
206 | 0 | return false; |
207 | 0 | } |
208 | 0 | nsString& slot1 = *slotPtr1; |
209 | 0 | if (!ConvertJSValueToString(cx, temp1, eStringify, eStringify, slot1)) { |
210 | 0 | return false; |
211 | 0 | } |
212 | 0 | NormalizeUSVString(slot1); |
213 | 0 | } |
214 | 0 | } else { |
215 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Element of member of USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString"); |
216 | 0 | return false; |
217 | 0 | } |
218 | 0 | } |
219 | 0 | } |
220 | 0 | return true; |
221 | 0 | } |
222 | | |
223 | | void |
224 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::DestroyUSVStringSequenceSequence() |
225 | 0 | { |
226 | 0 | MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!"); |
227 | 0 | mValue.mUSVStringSequenceSequence.Destroy(); |
228 | 0 | mType = eUninitialized; |
229 | 0 | } |
230 | | |
231 | | |
232 | | |
233 | | |
234 | | Record<nsString, nsString>& |
235 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::RawSetAsUSVStringUSVStringRecord() |
236 | 0 | { |
237 | 0 | if (mType == eUSVStringUSVStringRecord) { |
238 | 0 | return mValue.mUSVStringUSVStringRecord.Value(); |
239 | 0 | } |
240 | 0 | MOZ_ASSERT(mType == eUninitialized); |
241 | 0 | mType = eUSVStringUSVStringRecord; |
242 | 0 | return mValue.mUSVStringUSVStringRecord.SetValue(); |
243 | 0 | } |
244 | | |
245 | | Record<nsString, nsString>& |
246 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::SetAsUSVStringUSVStringRecord() |
247 | 0 | { |
248 | 0 | if (mType == eUSVStringUSVStringRecord) { |
249 | 0 | return mValue.mUSVStringUSVStringRecord.Value(); |
250 | 0 | } |
251 | 0 | Uninit(); |
252 | 0 | mType = eUSVStringUSVStringRecord; |
253 | 0 | return mValue.mUSVStringUSVStringRecord.SetValue(); |
254 | 0 | } |
255 | | |
256 | | bool |
257 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::TrySetToUSVStringUSVStringRecord(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl) |
258 | 0 | { |
259 | 0 | tryNext = false; |
260 | 0 | { // scope for memberSlot |
261 | 0 | Record<nsString, nsString>& memberSlot = RawSetAsUSVStringUSVStringRecord(); |
262 | 0 | auto& recordEntries = memberSlot.Entries(); |
263 | 0 |
|
264 | 0 | JS::Rooted<JSObject*> recordObj(cx, &value.toObject()); |
265 | 0 | JS::AutoIdVector ids(cx); |
266 | 0 | if (!js::GetPropertyKeys(cx, recordObj, |
267 | 0 | JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, &ids)) { |
268 | 0 | return false; |
269 | 0 | } |
270 | 0 | if (!recordEntries.SetCapacity(ids.length(), mozilla::fallible)) { |
271 | 0 | JS_ReportOutOfMemory(cx); |
272 | 0 | return false; |
273 | 0 | } |
274 | 0 | JS::Rooted<JS::Value> propNameValue(cx); |
275 | 0 | JS::Rooted<JS::Value> temp(cx); |
276 | 0 | JS::Rooted<jsid> curId(cx); |
277 | 0 | JS::Rooted<JS::Value> idVal(cx); |
278 | 0 | // Use a hashset to keep track of ids seen, to avoid |
279 | 0 | // introducing nasty O(N^2) behavior scanning for them all the |
280 | 0 | // time. Ideally we'd use a data structure with O(1) lookup |
281 | 0 | // _and_ ordering for the MozMap, but we don't have one lying |
282 | 0 | // around. |
283 | 0 | nsTHashtable<nsStringHashKey> idsSeen; |
284 | 0 | for (size_t i = 0; i < ids.length(); ++i) { |
285 | 0 | curId = ids[i]; |
286 | 0 |
|
287 | 0 | JS::Rooted<JS::PropertyDescriptor> desc(cx); |
288 | 0 | if (!JS_GetOwnPropertyDescriptorById(cx, recordObj, curId, |
289 | 0 | &desc)) { |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | |
293 | 0 | if (!desc.object() /* == undefined in spec terms */ || |
294 | 0 | !desc.enumerable()) { |
295 | 0 | continue; |
296 | 0 | } |
297 | 0 | |
298 | 0 | idVal = js::IdToValue(curId); |
299 | 0 | nsString propName; |
300 | 0 | // This will just throw if idVal is a Symbol, like the spec says |
301 | 0 | // to do. |
302 | 0 | if (!ConvertJSValueToUSVString(cx, idVal, propName)) { |
303 | 0 | return false; |
304 | 0 | } |
305 | 0 | |
306 | 0 | if (!JS_GetPropertyById(cx, recordObj, curId, &temp)) { |
307 | 0 | return false; |
308 | 0 | } |
309 | 0 | |
310 | 0 | Record<nsString, nsString>::EntryType* entry; |
311 | 0 | if (!idsSeen.EnsureInserted(propName)) { |
312 | 0 | // Find the existing entry. |
313 | 0 | auto idx = recordEntries.IndexOf(propName); |
314 | 0 | MOZ_ASSERT(idx != recordEntries.NoIndex, |
315 | 0 | "Why is it not found?"); |
316 | 0 | // Now blow it away to make it look like it was just added |
317 | 0 | // to the array, because it's not obvious that it's |
318 | 0 | // safe to write to its already-initialized mValue via our |
319 | 0 | // normal codegen conversions. For example, the value |
320 | 0 | // could be a union and this would change its type, but |
321 | 0 | // codegen assumes we won't do that. |
322 | 0 | entry = recordEntries.ReconstructElementAt(idx); |
323 | 0 | } else { |
324 | 0 | // Safe to do an infallible append here, because we did a |
325 | 0 | // SetCapacity above to the right capacity. |
326 | 0 | entry = recordEntries.AppendElement(); |
327 | 0 | } |
328 | 0 | entry->mKey = propName; |
329 | 0 | nsString& slot = entry->mValue; |
330 | 0 | if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) { |
331 | 0 | return false; |
332 | 0 | } |
333 | 0 | NormalizeUSVString(slot); |
334 | 0 | } |
335 | 0 | } |
336 | 0 | return true; |
337 | 0 | } |
338 | | |
339 | | void |
340 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::DestroyUSVStringUSVStringRecord() |
341 | 0 | { |
342 | 0 | MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!"); |
343 | 0 | mValue.mUSVStringUSVStringRecord.Destroy(); |
344 | 0 | mType = eUninitialized; |
345 | 0 | } |
346 | | |
347 | | |
348 | | |
349 | | |
350 | | nsString& |
351 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::RawSetAsUSVString() |
352 | 0 | { |
353 | 0 | if (mType == eUSVString) { |
354 | 0 | return mValue.mUSVString.Value(); |
355 | 0 | } |
356 | 0 | MOZ_ASSERT(mType == eUninitialized); |
357 | 0 | mType = eUSVString; |
358 | 0 | return mValue.mUSVString.SetValue(); |
359 | 0 | } |
360 | | |
361 | | nsString& |
362 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::SetAsUSVString() |
363 | 0 | { |
364 | 0 | if (mType == eUSVString) { |
365 | 0 | return mValue.mUSVString.Value(); |
366 | 0 | } |
367 | 0 | Uninit(); |
368 | 0 | mType = eUSVString; |
369 | 0 | return mValue.mUSVString.SetValue(); |
370 | 0 | } |
371 | | |
372 | | bool |
373 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::TrySetToUSVString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl) |
374 | 0 | { |
375 | 0 | tryNext = false; |
376 | 0 | { // scope for memberSlot |
377 | 0 | nsString& memberSlot = RawSetAsUSVString(); |
378 | 0 | if (!ConvertJSValueToString(cx, value, eStringify, eStringify, memberSlot)) { |
379 | 0 | return false; |
380 | 0 | } |
381 | 0 | NormalizeUSVString(memberSlot); |
382 | 0 | } |
383 | 0 | return true; |
384 | 0 | } |
385 | | |
386 | | |
387 | | void |
388 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::DestroyUSVString() |
389 | 0 | { |
390 | 0 | MOZ_ASSERT(IsUSVString(), "Wrong type!"); |
391 | 0 | mValue.mUSVString.Destroy(); |
392 | 0 | mType = eUninitialized; |
393 | 0 | } |
394 | | |
395 | | |
396 | | |
397 | | |
398 | | void |
399 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::Uninit() |
400 | | { |
401 | | switch (mType) { |
402 | | case eUninitialized: { |
403 | | break; |
404 | | } |
405 | | case eUSVStringSequenceSequence: { |
406 | | DestroyUSVStringSequenceSequence(); |
407 | | break; |
408 | | } |
409 | | case eUSVStringUSVStringRecord: { |
410 | | DestroyUSVStringUSVStringRecord(); |
411 | | break; |
412 | | } |
413 | | case eUSVString: { |
414 | | DestroyUSVString(); |
415 | | break; |
416 | | } |
417 | | } |
418 | | } |
419 | | |
420 | | bool |
421 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const |
422 | 0 | { |
423 | 0 | switch (mType) { |
424 | 0 | case eUninitialized: { |
425 | 0 | return false; |
426 | 0 | break; |
427 | 0 | } |
428 | 0 | case eUSVStringSequenceSequence: { |
429 | 0 |
|
430 | 0 | uint32_t length = mValue.mUSVStringSequenceSequence.Value().Length(); |
431 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
432 | 0 | if (!returnArray) { |
433 | 0 | return false; |
434 | 0 | } |
435 | 0 | // Scope for 'tmp' |
436 | 0 | { |
437 | 0 | JS::Rooted<JS::Value> tmp(cx); |
438 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
439 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
440 | 0 | // are different ways to succeed at wrapping the object. |
441 | 0 | do { |
442 | 0 |
|
443 | 0 | uint32_t length = mValue.mUSVStringSequenceSequence.Value()[sequenceIdx0].Length(); |
444 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
445 | 0 | if (!returnArray) { |
446 | 0 | return false; |
447 | 0 | } |
448 | 0 | // Scope for 'tmp' |
449 | 0 | { |
450 | 0 | JS::Rooted<JS::Value> tmp(cx); |
451 | 0 | for (uint32_t sequenceIdx1 = 0; sequenceIdx1 < length; ++sequenceIdx1) { |
452 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
453 | 0 | // are different ways to succeed at wrapping the object. |
454 | 0 | do { |
455 | 0 | if (!xpc::NonVoidStringToJsval(cx, mValue.mUSVStringSequenceSequence.Value()[sequenceIdx0][sequenceIdx1], &tmp)) { |
456 | 0 | return false; |
457 | 0 | } |
458 | 0 | break; |
459 | 0 | } while (false); |
460 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx1, tmp, |
461 | 0 | JSPROP_ENUMERATE)) { |
462 | 0 | return false; |
463 | 0 | } |
464 | 0 | } |
465 | 0 | } |
466 | 0 | tmp.setObject(*returnArray); |
467 | 0 | break; |
468 | 0 | } while (false); |
469 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
470 | 0 | JSPROP_ENUMERATE)) { |
471 | 0 | return false; |
472 | 0 | } |
473 | 0 | } |
474 | 0 | } |
475 | 0 | rval.setObject(*returnArray); |
476 | 0 | return true; |
477 | 0 | break; |
478 | 0 | } |
479 | 0 | case eUSVStringUSVStringRecord: { |
480 | 0 |
|
481 | 0 | JS::Rooted<JSObject*> returnObj(cx, JS_NewPlainObject(cx)); |
482 | 0 | if (!returnObj) { |
483 | 0 | return false; |
484 | 0 | } |
485 | 0 | // Scope for 'tmp' |
486 | 0 | { |
487 | 0 | JS::Rooted<JS::Value> tmp(cx); |
488 | 0 | for (auto& entry : mValue.mUSVStringUSVStringRecord.Value().Entries()) { |
489 | 0 | auto& recordValue0 = entry.mValue; |
490 | 0 | // Control block to let us common up the JS_DefineUCProperty calls when there |
491 | 0 | // are different ways to succeed at wrapping the value. |
492 | 0 | do { |
493 | 0 | if (!xpc::NonVoidStringToJsval(cx, recordValue0, &tmp)) { |
494 | 0 | return false; |
495 | 0 | } |
496 | 0 | break; |
497 | 0 | } while (false); |
498 | 0 | if (!JS_DefineUCProperty(cx, returnObj, |
499 | 0 | entry.mKey.BeginReading(), |
500 | 0 | entry.mKey.Length(), tmp, |
501 | 0 | JSPROP_ENUMERATE)) { |
502 | 0 | return false; |
503 | 0 | } |
504 | 0 | } |
505 | 0 | } |
506 | 0 | rval.setObject(*returnObj); |
507 | 0 | return true; |
508 | 0 | break; |
509 | 0 | } |
510 | 0 | case eUSVString: { |
511 | 0 | if (!xpc::NonVoidStringToJsval(cx, mValue.mUSVString.Value(), rval)) { |
512 | 0 | return false; |
513 | 0 | } |
514 | 0 | return true; |
515 | 0 | break; |
516 | 0 | } |
517 | 0 | default: { |
518 | 0 | return false; |
519 | 0 | break; |
520 | 0 | } |
521 | 0 | } |
522 | 0 | |
523 | 0 | return false; |
524 | 0 | } |
525 | | |
526 | | void |
527 | | OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::TraceUnion(JSTracer* trc) |
528 | 0 | { |
529 | 0 | } |
530 | | |
531 | | |
532 | | namespace URLSearchParams_Binding { |
533 | | |
534 | | MOZ_CAN_RUN_SCRIPT static bool |
535 | | append(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
536 | 0 | { |
537 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.append", DOM, cx); |
538 | 0 |
|
539 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
540 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.append"); |
541 | 0 | } |
542 | 0 | binding_detail::FakeString arg0; |
543 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
544 | 0 | return false; |
545 | 0 | } |
546 | 0 | NormalizeUSVString(arg0); |
547 | 0 | binding_detail::FakeString arg1; |
548 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
549 | 0 | return false; |
550 | 0 | } |
551 | 0 | NormalizeUSVString(arg1); |
552 | 0 | self->Append(Constify(arg0), Constify(arg1)); |
553 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
554 | 0 | args.rval().setUndefined(); |
555 | 0 | return true; |
556 | 0 | } |
557 | | |
558 | | static const JSJitInfo append_methodinfo = { |
559 | | { (JSJitGetterOp)append }, |
560 | | { prototypes::id::URLSearchParams }, |
561 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
562 | | JSJitInfo::Method, |
563 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
564 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
565 | | false, /* isInfallible. False in setters. */ |
566 | | false, /* isMovable. Not relevant for setters. */ |
567 | | false, /* isEliminatable. Not relevant for setters. */ |
568 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
569 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
570 | | false, /* isTypedMethod. Only relevant for methods. */ |
571 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
572 | | }; |
573 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
574 | | static_assert(0 < 1, "There is no slot for us"); |
575 | | |
576 | | MOZ_CAN_RUN_SCRIPT static bool |
577 | | _delete_(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
578 | 0 | { |
579 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.delete", DOM, cx); |
580 | 0 |
|
581 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
582 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.delete"); |
583 | 0 | } |
584 | 0 | binding_detail::FakeString arg0; |
585 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
586 | 0 | return false; |
587 | 0 | } |
588 | 0 | NormalizeUSVString(arg0); |
589 | 0 | self->Delete(Constify(arg0)); |
590 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
591 | 0 | args.rval().setUndefined(); |
592 | 0 | return true; |
593 | 0 | } |
594 | | |
595 | | static const JSJitInfo delete_methodinfo = { |
596 | | { (JSJitGetterOp)_delete_ }, |
597 | | { prototypes::id::URLSearchParams }, |
598 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
599 | | JSJitInfo::Method, |
600 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
601 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
602 | | false, /* isInfallible. False in setters. */ |
603 | | false, /* isMovable. Not relevant for setters. */ |
604 | | false, /* isEliminatable. Not relevant for setters. */ |
605 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
606 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
607 | | false, /* isTypedMethod. Only relevant for methods. */ |
608 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
609 | | }; |
610 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
611 | | static_assert(0 < 1, "There is no slot for us"); |
612 | | |
613 | | MOZ_CAN_RUN_SCRIPT static bool |
614 | | get(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
615 | 0 | { |
616 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.get", DOM, cx); |
617 | 0 |
|
618 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
619 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.get"); |
620 | 0 | } |
621 | 0 | binding_detail::FakeString arg0; |
622 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
623 | 0 | return false; |
624 | 0 | } |
625 | 0 | NormalizeUSVString(arg0); |
626 | 0 | DOMString result; |
627 | 0 | self->Get(Constify(arg0), result); |
628 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
629 | 0 | if (!xpc::StringToJsval(cx, result, args.rval())) { |
630 | 0 | return false; |
631 | 0 | } |
632 | 0 | return true; |
633 | 0 | } |
634 | | |
635 | | static const JSJitInfo get_methodinfo = { |
636 | | { (JSJitGetterOp)get }, |
637 | | { prototypes::id::URLSearchParams }, |
638 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
639 | | JSJitInfo::Method, |
640 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
641 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
642 | | false, /* isInfallible. False in setters. */ |
643 | | false, /* isMovable. Not relevant for setters. */ |
644 | | false, /* isEliminatable. Not relevant for setters. */ |
645 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
646 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
647 | | false, /* isTypedMethod. Only relevant for methods. */ |
648 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
649 | | }; |
650 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
651 | | static_assert(0 < 1, "There is no slot for us"); |
652 | | |
653 | | MOZ_CAN_RUN_SCRIPT static bool |
654 | | getAll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
655 | 0 | { |
656 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.getAll", DOM, cx); |
657 | 0 |
|
658 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
659 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.getAll"); |
660 | 0 | } |
661 | 0 | binding_detail::FakeString arg0; |
662 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
663 | 0 | return false; |
664 | 0 | } |
665 | 0 | NormalizeUSVString(arg0); |
666 | 0 | nsTArray<nsString> result; |
667 | 0 | self->GetAll(Constify(arg0), result); |
668 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
669 | 0 |
|
670 | 0 | uint32_t length = result.Length(); |
671 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
672 | 0 | if (!returnArray) { |
673 | 0 | return false; |
674 | 0 | } |
675 | 0 | // Scope for 'tmp' |
676 | 0 | { |
677 | 0 | JS::Rooted<JS::Value> tmp(cx); |
678 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
679 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
680 | 0 | // are different ways to succeed at wrapping the object. |
681 | 0 | do { |
682 | 0 | if (!xpc::NonVoidStringToJsval(cx, result[sequenceIdx0], &tmp)) { |
683 | 0 | return false; |
684 | 0 | } |
685 | 0 | break; |
686 | 0 | } while (false); |
687 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
688 | 0 | JSPROP_ENUMERATE)) { |
689 | 0 | return false; |
690 | 0 | } |
691 | 0 | } |
692 | 0 | } |
693 | 0 | args.rval().setObject(*returnArray); |
694 | 0 | return true; |
695 | 0 | } |
696 | | |
697 | | static const JSJitInfo getAll_methodinfo = { |
698 | | { (JSJitGetterOp)getAll }, |
699 | | { prototypes::id::URLSearchParams }, |
700 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
701 | | JSJitInfo::Method, |
702 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
703 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
704 | | false, /* isInfallible. False in setters. */ |
705 | | false, /* isMovable. Not relevant for setters. */ |
706 | | false, /* isEliminatable. Not relevant for setters. */ |
707 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
708 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
709 | | false, /* isTypedMethod. Only relevant for methods. */ |
710 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
711 | | }; |
712 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
713 | | static_assert(0 < 1, "There is no slot for us"); |
714 | | |
715 | | MOZ_CAN_RUN_SCRIPT static bool |
716 | | has(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
717 | 0 | { |
718 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.has", DOM, cx); |
719 | 0 |
|
720 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
721 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.has"); |
722 | 0 | } |
723 | 0 | binding_detail::FakeString arg0; |
724 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
725 | 0 | return false; |
726 | 0 | } |
727 | 0 | NormalizeUSVString(arg0); |
728 | 0 | bool result(self->Has(Constify(arg0))); |
729 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
730 | 0 | args.rval().setBoolean(result); |
731 | 0 | return true; |
732 | 0 | } |
733 | | |
734 | | static const JSJitInfo has_methodinfo = { |
735 | | { (JSJitGetterOp)has }, |
736 | | { prototypes::id::URLSearchParams }, |
737 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
738 | | JSJitInfo::Method, |
739 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
740 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
741 | | false, /* isInfallible. False in setters. */ |
742 | | false, /* isMovable. Not relevant for setters. */ |
743 | | false, /* isEliminatable. Not relevant for setters. */ |
744 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
745 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
746 | | false, /* isTypedMethod. Only relevant for methods. */ |
747 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
748 | | }; |
749 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
750 | | static_assert(0 < 1, "There is no slot for us"); |
751 | | |
752 | | MOZ_CAN_RUN_SCRIPT static bool |
753 | | set(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
754 | 0 | { |
755 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.set", DOM, cx); |
756 | 0 |
|
757 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
758 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "URLSearchParams.set"); |
759 | 0 | } |
760 | 0 | binding_detail::FakeString arg0; |
761 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
762 | 0 | return false; |
763 | 0 | } |
764 | 0 | NormalizeUSVString(arg0); |
765 | 0 | binding_detail::FakeString arg1; |
766 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
767 | 0 | return false; |
768 | 0 | } |
769 | 0 | NormalizeUSVString(arg1); |
770 | 0 | self->Set(Constify(arg0), Constify(arg1)); |
771 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
772 | 0 | args.rval().setUndefined(); |
773 | 0 | return true; |
774 | 0 | } |
775 | | |
776 | | static const JSJitInfo set_methodinfo = { |
777 | | { (JSJitGetterOp)set }, |
778 | | { prototypes::id::URLSearchParams }, |
779 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
780 | | JSJitInfo::Method, |
781 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
782 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
783 | | false, /* isInfallible. False in setters. */ |
784 | | false, /* isMovable. Not relevant for setters. */ |
785 | | false, /* isEliminatable. Not relevant for setters. */ |
786 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
787 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
788 | | false, /* isTypedMethod. Only relevant for methods. */ |
789 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
790 | | }; |
791 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
792 | | static_assert(0 < 1, "There is no slot for us"); |
793 | | |
794 | | MOZ_CAN_RUN_SCRIPT static bool |
795 | | sort(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
796 | 0 | { |
797 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.sort", DOM, cx); |
798 | 0 |
|
799 | 0 | FastErrorResult rv; |
800 | 0 | self->Sort(rv); |
801 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
802 | 0 | return false; |
803 | 0 | } |
804 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
805 | 0 | args.rval().setUndefined(); |
806 | 0 | return true; |
807 | 0 | } |
808 | | |
809 | | static const JSJitInfo sort_methodinfo = { |
810 | | { (JSJitGetterOp)sort }, |
811 | | { prototypes::id::URLSearchParams }, |
812 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
813 | | JSJitInfo::Method, |
814 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
815 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
816 | | false, /* isInfallible. False in setters. */ |
817 | | false, /* isMovable. Not relevant for setters. */ |
818 | | false, /* isEliminatable. Not relevant for setters. */ |
819 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
820 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
821 | | false, /* isTypedMethod. Only relevant for methods. */ |
822 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
823 | | }; |
824 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
825 | | static_assert(0 < 1, "There is no slot for us"); |
826 | | |
827 | | MOZ_CAN_RUN_SCRIPT static bool |
828 | | __stringifier(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
829 | 0 | { |
830 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.__stringifier", DOM, cx); |
831 | 0 |
|
832 | 0 | DOMString result; |
833 | 0 | self->Stringify(result); |
834 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
835 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
836 | 0 | return false; |
837 | 0 | } |
838 | 0 | return true; |
839 | 0 | } |
840 | | |
841 | | static const JSJitInfo __stringifier_methodinfo = { |
842 | | { (JSJitGetterOp)__stringifier }, |
843 | | { prototypes::id::URLSearchParams }, |
844 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
845 | | JSJitInfo::Method, |
846 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
847 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
848 | | false, /* isInfallible. False in setters. */ |
849 | | false, /* isMovable. Not relevant for setters. */ |
850 | | false, /* isEliminatable. Not relevant for setters. */ |
851 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
852 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
853 | | false, /* isTypedMethod. Only relevant for methods. */ |
854 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
855 | | }; |
856 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
857 | | static_assert(0 < 1, "There is no slot for us"); |
858 | | |
859 | | MOZ_CAN_RUN_SCRIPT static bool |
860 | | entries(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
861 | 0 | { |
862 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.entries", DOM, cx); |
863 | 0 |
|
864 | 0 | typedef mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> itrType; |
865 | 0 | RefPtr<itrType> result(new itrType(self, |
866 | 0 | itrType::IterableIteratorType::Entries, |
867 | 0 | &URLSearchParamsIterator_Binding::Wrap)); |
868 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
869 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
870 | 0 | if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) { |
871 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
872 | 0 | return false; |
873 | 0 | } |
874 | 0 | return true; |
875 | 0 | } |
876 | | |
877 | | static const JSJitInfo::ArgType entries_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd }; |
878 | | static const JSTypedMethodJitInfo entries_methodinfo = { |
879 | | { |
880 | | { (JSJitGetterOp)entries }, |
881 | | { prototypes::id::URLSearchParams }, |
882 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
883 | | JSJitInfo::Method, |
884 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
885 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
886 | | false, /* isInfallible. False in setters. */ |
887 | | false, /* isMovable. Not relevant for setters. */ |
888 | | false, /* isEliminatable. Not relevant for setters. */ |
889 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
890 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
891 | | true, /* isTypedMethod. Only relevant for methods. */ |
892 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
893 | | }, |
894 | | entries_methodinfo_argTypes |
895 | | }; |
896 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
897 | | static_assert(0 < 1, "There is no slot for us"); |
898 | | |
899 | | MOZ_CAN_RUN_SCRIPT static bool |
900 | | keys(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
901 | 0 | { |
902 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.keys", DOM, cx); |
903 | 0 |
|
904 | 0 | typedef mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> itrType; |
905 | 0 | RefPtr<itrType> result(new itrType(self, |
906 | 0 | itrType::IterableIteratorType::Keys, |
907 | 0 | &URLSearchParamsIterator_Binding::Wrap)); |
908 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
909 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
910 | 0 | if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) { |
911 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
912 | 0 | return false; |
913 | 0 | } |
914 | 0 | return true; |
915 | 0 | } |
916 | | |
917 | | static const JSJitInfo::ArgType keys_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd }; |
918 | | static const JSTypedMethodJitInfo keys_methodinfo = { |
919 | | { |
920 | | { (JSJitGetterOp)keys }, |
921 | | { prototypes::id::URLSearchParams }, |
922 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
923 | | JSJitInfo::Method, |
924 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
925 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
926 | | false, /* isInfallible. False in setters. */ |
927 | | false, /* isMovable. Not relevant for setters. */ |
928 | | false, /* isEliminatable. Not relevant for setters. */ |
929 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
930 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
931 | | true, /* isTypedMethod. Only relevant for methods. */ |
932 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
933 | | }, |
934 | | keys_methodinfo_argTypes |
935 | | }; |
936 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
937 | | static_assert(0 < 1, "There is no slot for us"); |
938 | | |
939 | | MOZ_CAN_RUN_SCRIPT static bool |
940 | | values(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
941 | 0 | { |
942 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.values", DOM, cx); |
943 | 0 |
|
944 | 0 | typedef mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> itrType; |
945 | 0 | RefPtr<itrType> result(new itrType(self, |
946 | 0 | itrType::IterableIteratorType::Values, |
947 | 0 | &URLSearchParamsIterator_Binding::Wrap)); |
948 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
949 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
950 | 0 | if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) { |
951 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
952 | 0 | return false; |
953 | 0 | } |
954 | 0 | return true; |
955 | 0 | } |
956 | | |
957 | | static const JSJitInfo::ArgType values_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd }; |
958 | | static const JSTypedMethodJitInfo values_methodinfo = { |
959 | | { |
960 | | { (JSJitGetterOp)values }, |
961 | | { prototypes::id::URLSearchParams }, |
962 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
963 | | JSJitInfo::Method, |
964 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
965 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
966 | | false, /* isInfallible. False in setters. */ |
967 | | false, /* isMovable. Not relevant for setters. */ |
968 | | false, /* isEliminatable. Not relevant for setters. */ |
969 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
970 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
971 | | true, /* isTypedMethod. Only relevant for methods. */ |
972 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
973 | | }, |
974 | | values_methodinfo_argTypes |
975 | | }; |
976 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
977 | | static_assert(0 < 1, "There is no slot for us"); |
978 | | |
979 | | MOZ_CAN_RUN_SCRIPT static bool |
980 | | forEach(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::URLSearchParams* self, const JSJitMethodCallArgs& args) |
981 | 0 | { |
982 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams.forEach", DOM, cx); |
983 | 0 |
|
984 | 0 | JS::Rooted<JSObject*> arg0(cx); |
985 | 0 | if (args.get(0).isObject()) { |
986 | 0 | arg0 = &args.get(0).toObject(); |
987 | 0 | } else { |
988 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of URLSearchParams.forEach"); |
989 | 0 | return false; |
990 | 0 | } |
991 | 0 | JS::Rooted<JS::Value> arg1(cx); |
992 | 0 | if (args.hasDefined(1)) { |
993 | 0 | arg1 = args.get(1); |
994 | 0 | } else { |
995 | 0 | arg1 = JS::UndefinedValue(); |
996 | 0 | } |
997 | 0 | if (!JS::IsCallable(arg0)) { |
998 | 0 | ThrowErrorMessage(cx, MSG_NOT_CALLABLE, "Argument 1 of URLSearchParams.forEach"); |
999 | 0 | return false; |
1000 | 0 | } |
1001 | 0 | JS::AutoValueArray<3> callArgs(cx); |
1002 | 0 | callArgs[2].setObject(*obj); |
1003 | 0 | JS::Rooted<JS::Value> ignoredReturnVal(cx); |
1004 | 0 | auto GetKeyAtIndex = &mozilla::dom::URLSearchParams::GetKeyAtIndex; |
1005 | 0 | auto GetValueAtIndex = &mozilla::dom::URLSearchParams::GetValueAtIndex; |
1006 | 0 | for (size_t i = 0; i < self->GetIterableLength(); ++i) { |
1007 | 0 | if (!CallIterableGetter(cx, GetValueAtIndex, self, i, |
1008 | 0 | callArgs[0])) { |
1009 | 0 | return false; |
1010 | 0 | } |
1011 | 0 | if (!CallIterableGetter(cx, GetKeyAtIndex, self, i, |
1012 | 0 | callArgs[1])) { |
1013 | 0 | return false; |
1014 | 0 | } |
1015 | 0 | if (!JS::Call(cx, arg1, arg0, JS::HandleValueArray(callArgs), |
1016 | 0 | &ignoredReturnVal)) { |
1017 | 0 | return false; |
1018 | 0 | } |
1019 | 0 | } |
1020 | 0 | args.rval().setUndefined(); |
1021 | 0 | return true; |
1022 | 0 | } |
1023 | | |
1024 | | static const JSJitInfo forEach_methodinfo = { |
1025 | | { (JSJitGetterOp)forEach }, |
1026 | | { prototypes::id::URLSearchParams }, |
1027 | | { PrototypeTraits<prototypes::id::URLSearchParams>::Depth }, |
1028 | | JSJitInfo::Method, |
1029 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1030 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1031 | | false, /* isInfallible. False in setters. */ |
1032 | | false, /* isMovable. Not relevant for setters. */ |
1033 | | false, /* isEliminatable. Not relevant for setters. */ |
1034 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1035 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1036 | | false, /* isTypedMethod. Only relevant for methods. */ |
1037 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1038 | | }; |
1039 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1040 | | static_assert(0 < 1, "There is no slot for us"); |
1041 | | |
1042 | | static bool |
1043 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1044 | 0 | { |
1045 | 0 | mozilla::dom::URLSearchParams* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::URLSearchParams>(obj); |
1046 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1047 | 0 | // obviously can't preserve if we're not initialized. |
1048 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1049 | 0 | PreserveWrapper(self); |
1050 | 0 | } |
1051 | 0 | return true; |
1052 | 0 | } |
1053 | | |
1054 | | static void |
1055 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1056 | 0 | { |
1057 | 0 | mozilla::dom::URLSearchParams* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::URLSearchParams>(obj); |
1058 | 0 | if (self) { |
1059 | 0 | ClearWrapper(self, self, obj); |
1060 | 0 | AddForDeferredFinalization<mozilla::dom::URLSearchParams>(self); |
1061 | 0 | } |
1062 | 0 | } |
1063 | | |
1064 | | static size_t |
1065 | | _objectMoved(JSObject* obj, JSObject* old) |
1066 | 0 | { |
1067 | 0 | mozilla::dom::URLSearchParams* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::URLSearchParams>(obj); |
1068 | 0 | if (self) { |
1069 | 0 | UpdateWrapper(self, self, obj, old); |
1070 | 0 | } |
1071 | 0 |
|
1072 | 0 | return 0; |
1073 | 0 | } |
1074 | | |
1075 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1076 | | #if defined(__clang__) |
1077 | | #pragma clang diagnostic push |
1078 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1079 | | #endif |
1080 | | static const JSFunctionSpec sMethods_specs[] = { |
1081 | | JS_FNSPEC("append", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&append_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1082 | | JS_FNSPEC("delete", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&delete_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1083 | | JS_FNSPEC("get", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&get_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1084 | | JS_FNSPEC("getAll", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getAll_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1085 | | JS_FNSPEC("has", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&has_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1086 | | JS_FNSPEC("set", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&set_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1087 | | JS_FNSPEC("sort", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&sort_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1088 | | JS_FNSPEC("entries", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&entries_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1089 | | JS_FNSPEC("keys", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&keys_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1090 | | JS_FNSPEC("values", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&values_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1091 | | JS_FNSPEC("forEach", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forEach_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1092 | | JS_FNSPEC("toString", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&__stringifier_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1093 | | JS_FS_END |
1094 | | }; |
1095 | | #if defined(__clang__) |
1096 | | #pragma clang diagnostic pop |
1097 | | #endif |
1098 | | |
1099 | | |
1100 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1101 | | { nullptr, &sMethods_specs[0] }, |
1102 | | { nullptr, nullptr } |
1103 | | }; |
1104 | | |
1105 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1106 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1107 | | static_assert(12 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1108 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1109 | | |
1110 | | |
1111 | | static uint16_t sNativeProperties_sortedPropertyIndices[12]; |
1112 | | static PropertyInfo sNativeProperties_propertyInfos[12]; |
1113 | | |
1114 | | static const NativePropertiesN<1> sNativeProperties = { |
1115 | | false, 0, |
1116 | | false, 0, |
1117 | | true, 0 /* sMethods */, |
1118 | | false, 0, |
1119 | | false, 0, |
1120 | | false, 0, |
1121 | | false, 0, |
1122 | | 7, |
1123 | | 12, |
1124 | | sNativeProperties_sortedPropertyIndices, |
1125 | | { |
1126 | | { sMethods, &sNativeProperties_propertyInfos[0] } |
1127 | | } |
1128 | | }; |
1129 | | static_assert(7 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.iteratorAliasMethodIndex) - 1), |
1130 | | "We have an iterator alias index that is oversized"); |
1131 | | static_assert(12 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1132 | | "We have a property info count that is oversized"); |
1133 | | |
1134 | | static bool |
1135 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
1136 | 0 | { |
1137 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParams constructor", DOM, cx); |
1138 | 0 |
|
1139 | 0 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
1140 | 0 | JS::Rooted<JSObject*> obj(cx, &args.callee()); |
1141 | 0 | if (!args.isConstructing()) { |
1142 | 0 | // XXXbz wish I could get the name from the callee instead of |
1143 | 0 | // Adding more relocations |
1144 | 0 | return ThrowConstructorWithoutNew(cx, "URLSearchParams"); |
1145 | 0 | } |
1146 | 0 | |
1147 | 0 | JS::Rooted<JSObject*> desiredProto(cx); |
1148 | 0 | if (!GetDesiredProto(cx, args, &desiredProto)) { |
1149 | 0 | return false; |
1150 | 0 | } |
1151 | 0 | |
1152 | 0 | GlobalObject global(cx, obj); |
1153 | 0 | if (global.Failed()) { |
1154 | 0 | return false; |
1155 | 0 | } |
1156 | 0 | |
1157 | 0 | bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); |
1158 | 0 | USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString arg0; |
1159 | 0 | USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVStringArgument arg0_holder(arg0); |
1160 | 0 | if (!(args.hasDefined(0))) { |
1161 | 0 | static const char16_t data[] = { 0 }; |
1162 | 0 | arg0_holder.SetStringData(data, ArrayLength(data) - 1); |
1163 | 0 | } else { |
1164 | 0 | { |
1165 | 0 | bool done = false, failed = false, tryNext; |
1166 | 0 | if (args[0].isObject()) { |
1167 | 0 | done = (failed = !arg0_holder.TrySetToUSVStringSequenceSequence(cx, args[0], tryNext, false)) || !tryNext; |
1168 | 0 | if (!done) { |
1169 | 0 | done = (failed = !arg0_holder.TrySetToUSVStringUSVStringRecord(cx, args[0], tryNext, false)) || !tryNext; |
1170 | 0 | } |
1171 | 0 | } |
1172 | 0 | if (!done) { |
1173 | 0 | do { |
1174 | 0 | done = (failed = !arg0_holder.TrySetToUSVString(cx, args[0], tryNext)) || !tryNext; |
1175 | 0 | break; |
1176 | 0 | } while (false); |
1177 | 0 | } |
1178 | 0 | if (failed) { |
1179 | 0 | return false; |
1180 | 0 | } |
1181 | 0 | if (!done) { |
1182 | 0 | ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of URLSearchParams.constructor", "USVStringSequenceSequence, USVStringUSVStringRecord"); |
1183 | 0 | return false; |
1184 | 0 | } |
1185 | 0 | } |
1186 | 0 | } |
1187 | 0 | Maybe<JSAutoRealm> ar; |
1188 | 0 | if (objIsXray) { |
1189 | 0 | obj = js::CheckedUnwrap(obj); |
1190 | 0 | if (!obj) { |
1191 | 0 | return false; |
1192 | 0 | } |
1193 | 0 | ar.emplace(cx, obj); |
1194 | 0 | if (!JS_WrapObject(cx, &desiredProto)) { |
1195 | 0 | return false; |
1196 | 0 | } |
1197 | 0 | } |
1198 | 0 | FastErrorResult rv; |
1199 | 0 | auto result(StrongOrRawPtr<mozilla::dom::URLSearchParams>(mozilla::dom::URLSearchParams::Constructor(global, Constify(arg0), rv))); |
1200 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1201 | 0 | return false; |
1202 | 0 | } |
1203 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1204 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
1205 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
1206 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) { |
1207 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1208 | 0 | return false; |
1209 | 0 | } |
1210 | 0 | return true; |
1211 | 0 | } |
1212 | | |
1213 | | static const js::ClassOps sInterfaceObjectClassOps = { |
1214 | | nullptr, /* addProperty */ |
1215 | | nullptr, /* delProperty */ |
1216 | | nullptr, /* enumerate */ |
1217 | | nullptr, /* newEnumerate */ |
1218 | | nullptr, /* resolve */ |
1219 | | nullptr, /* mayResolve */ |
1220 | | nullptr, /* finalize */ |
1221 | | _constructor, /* call */ |
1222 | | nullptr, /* hasInstance */ |
1223 | | _constructor, /* construct */ |
1224 | | nullptr, /* trace */ |
1225 | | }; |
1226 | | |
1227 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1228 | | { |
1229 | | "Function", |
1230 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1231 | | &sInterfaceObjectClassOps, |
1232 | | JS_NULL_CLASS_SPEC, |
1233 | | JS_NULL_CLASS_EXT, |
1234 | | &sInterfaceObjectClassObjectOps |
1235 | | }, |
1236 | | eInterface, |
1237 | | true, |
1238 | | prototypes::id::URLSearchParams, |
1239 | | PrototypeTraits<prototypes::id::URLSearchParams>::Depth, |
1240 | | sNativePropertyHooks, |
1241 | | "function URLSearchParams() {\n [native code]\n}", |
1242 | | JS::GetRealmFunctionPrototype |
1243 | | }; |
1244 | | |
1245 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1246 | | { |
1247 | | "URLSearchParamsPrototype", |
1248 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1249 | | JS_NULL_CLASS_OPS, |
1250 | | JS_NULL_CLASS_SPEC, |
1251 | | JS_NULL_CLASS_EXT, |
1252 | | JS_NULL_OBJECT_OPS |
1253 | | }, |
1254 | | eInterfacePrototype, |
1255 | | false, |
1256 | | prototypes::id::URLSearchParams, |
1257 | | PrototypeTraits<prototypes::id::URLSearchParams>::Depth, |
1258 | | sNativePropertyHooks, |
1259 | | "[object URLSearchParamsPrototype]", |
1260 | | JS::GetRealmObjectPrototype |
1261 | | }; |
1262 | | |
1263 | | static const js::ClassOps sClassOps = { |
1264 | | _addProperty, /* addProperty */ |
1265 | | nullptr, /* delProperty */ |
1266 | | nullptr, /* enumerate */ |
1267 | | nullptr, /* newEnumerate */ |
1268 | | nullptr, /* resolve */ |
1269 | | nullptr, /* mayResolve */ |
1270 | | _finalize, /* finalize */ |
1271 | | nullptr, /* call */ |
1272 | | nullptr, /* hasInstance */ |
1273 | | nullptr, /* construct */ |
1274 | | nullptr, /* trace */ |
1275 | | }; |
1276 | | |
1277 | | static const js::ClassExtension sClassExtension = { |
1278 | | nullptr, /* weakmapKeyDelegateOp */ |
1279 | | _objectMoved /* objectMovedOp */ |
1280 | | }; |
1281 | | |
1282 | | static const DOMJSClass sClass = { |
1283 | | { "URLSearchParams", |
1284 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1285 | | &sClassOps, |
1286 | | JS_NULL_CLASS_SPEC, |
1287 | | &sClassExtension, |
1288 | | JS_NULL_OBJECT_OPS |
1289 | | }, |
1290 | | { prototypes::id::URLSearchParams, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1291 | | IsBaseOf<nsISupports, mozilla::dom::URLSearchParams >::value, |
1292 | | sNativePropertyHooks, |
1293 | | FindAssociatedGlobalForNative<mozilla::dom::URLSearchParams>::Get, |
1294 | | GetProtoObjectHandle, |
1295 | | GetCCParticipant<mozilla::dom::URLSearchParams>::Get() |
1296 | | }; |
1297 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1298 | | "Must have the right minimal number of reserved slots."); |
1299 | | static_assert(1 >= 1, |
1300 | | "Must have enough reserved slots."); |
1301 | | |
1302 | | const JSClass* |
1303 | | GetJSClass() |
1304 | 0 | { |
1305 | 0 | return sClass.ToJSClass(); |
1306 | 0 | } |
1307 | | |
1308 | | bool |
1309 | | Wrap(JSContext* aCx, mozilla::dom::URLSearchParams* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1310 | 0 | { |
1311 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::URLSearchParams>::value, |
1312 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1313 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::URLSearchParams*>(aObject) == |
1314 | 0 | reinterpret_cast<mozilla::dom::URLSearchParams*>(aObject), |
1315 | 0 | "Multiple inheritance for mozilla::dom::URLSearchParams is broken."); |
1316 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1317 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1318 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1319 | 0 | "You should probably not be using Wrap() directly; use " |
1320 | 0 | "GetOrCreateDOMReflector instead"); |
1321 | 0 |
|
1322 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1323 | 0 | "nsISupports must be on our primary inheritance chain"); |
1324 | 0 |
|
1325 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1326 | 0 | if (!global) { |
1327 | 0 | return false; |
1328 | 0 | } |
1329 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1330 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1331 | 0 |
|
1332 | 0 | // That might have ended up wrapping us already, due to the wonders |
1333 | 0 | // of XBL. Check for that, and bail out as needed. |
1334 | 0 | aReflector.set(aCache->GetWrapper()); |
1335 | 0 | if (aReflector) { |
1336 | | #ifdef DEBUG |
1337 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1338 | | #endif // DEBUG |
1339 | | return true; |
1340 | 0 | } |
1341 | 0 |
|
1342 | 0 | JSAutoRealm ar(aCx, global); |
1343 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1344 | 0 | if (!canonicalProto) { |
1345 | 0 | return false; |
1346 | 0 | } |
1347 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1348 | 0 | if (aGivenProto) { |
1349 | 0 | proto = aGivenProto; |
1350 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1351 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1352 | 0 | // to wrap the proto here. |
1353 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1354 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1355 | 0 | return false; |
1356 | 0 | } |
1357 | 0 | } |
1358 | 0 | } else { |
1359 | 0 | proto = canonicalProto; |
1360 | 0 | } |
1361 | 0 |
|
1362 | 0 | BindingJSObjectCreator<mozilla::dom::URLSearchParams> creator(aCx); |
1363 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1364 | 0 | if (!aReflector) { |
1365 | 0 | return false; |
1366 | 0 | } |
1367 | 0 | |
1368 | 0 | aCache->SetWrapper(aReflector); |
1369 | 0 | creator.InitializationSucceeded(); |
1370 | 0 |
|
1371 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1372 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1373 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1374 | 0 | // otherwise we won't be able to properly recreate it later, since |
1375 | 0 | // we won't know what proto to use. Note that we don't check |
1376 | 0 | // aGivenProto here, since it's entirely possible (and even |
1377 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1378 | 0 | // same as canonicalProto. |
1379 | 0 | if (proto != canonicalProto) { |
1380 | 0 | PreserveWrapper(aObject); |
1381 | 0 | } |
1382 | 0 |
|
1383 | 0 | return true; |
1384 | 0 | } |
1385 | | |
1386 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1387 | | nullptr, |
1388 | | nullptr, |
1389 | | nullptr, |
1390 | | { sNativeProperties.Upcast(), nullptr }, |
1391 | | prototypes::id::URLSearchParams, |
1392 | | constructors::id::URLSearchParams, |
1393 | | nullptr, |
1394 | | &DefaultXrayExpandoObjectClass |
1395 | | } }; |
1396 | | |
1397 | | void |
1398 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1399 | 0 | { |
1400 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
1401 | 0 | if (!parentProto) { |
1402 | 0 | return; |
1403 | 0 | } |
1404 | 0 | |
1405 | 0 | JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx)); |
1406 | 0 | if (!constructorProto) { |
1407 | 0 | return; |
1408 | 0 | } |
1409 | 0 | |
1410 | 0 | static bool sIdsInited = false; |
1411 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1412 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1413 | 0 | return; |
1414 | 0 | } |
1415 | 0 | sIdsInited = true; |
1416 | 0 | } |
1417 | 0 |
|
1418 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::URLSearchParams); |
1419 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::URLSearchParams); |
1420 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1421 | 0 | &sPrototypeClass.mBase, protoCache, |
1422 | 0 | nullptr, |
1423 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
1424 | 0 | interfaceCache, |
1425 | 0 | sNativeProperties.Upcast(), |
1426 | 0 | nullptr, |
1427 | 0 | "URLSearchParams", aDefineOnGlobal, |
1428 | 0 | nullptr, |
1429 | 0 | false); |
1430 | 0 |
|
1431 | 0 | // Set up aliases on the interface prototype object we just created. |
1432 | 0 | JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx); |
1433 | 0 | if (!proto) { |
1434 | 0 | *protoCache = nullptr; |
1435 | 0 | if (interfaceCache) { |
1436 | 0 | *interfaceCache = nullptr; |
1437 | 0 | } |
1438 | 0 | return; |
1439 | 0 | } |
1440 | 0 |
|
1441 | 0 | JS::Rooted<JS::Value> aliasedVal(aCx); |
1442 | 0 |
|
1443 | 0 | if (!JS_GetProperty(aCx, proto, "entries", &aliasedVal)) { |
1444 | 0 | *protoCache = nullptr; |
1445 | 0 | if (interfaceCache) { |
1446 | 0 | *interfaceCache = nullptr; |
1447 | 0 | } |
1448 | 0 | return; |
1449 | 0 | } |
1450 | 0 | JS::Rooted<jsid> iteratorId(aCx, SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::iterator))); |
1451 | 0 | if (!JS_DefinePropertyById(aCx, proto, iteratorId, aliasedVal, 0)) { |
1452 | 0 | *protoCache = nullptr; |
1453 | 0 | if (interfaceCache) { |
1454 | 0 | *interfaceCache = nullptr; |
1455 | 0 | } |
1456 | 0 | return; |
1457 | 0 | } |
1458 | 0 | } |
1459 | | |
1460 | | JSObject* |
1461 | | GetConstructorObject(JSContext* aCx) |
1462 | 0 | { |
1463 | 0 | return GetConstructorObjectHandle(aCx); |
1464 | 0 | } |
1465 | | |
1466 | | } // namespace URLSearchParams_Binding |
1467 | | |
1468 | | |
1469 | | |
1470 | | namespace URLSearchParamsIterator_Binding { |
1471 | | |
1472 | | MOZ_CAN_RUN_SCRIPT static bool |
1473 | | next(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>* self, const JSJitMethodCallArgs& args) |
1474 | 0 | { |
1475 | 0 | AUTO_PROFILER_LABEL_FAST("URLSearchParamsIterator.next", DOM, cx); |
1476 | 0 |
|
1477 | 0 | FastErrorResult rv; |
1478 | 0 | JS::Rooted<JSObject*> result(cx); |
1479 | 0 | self->Next(cx, &result, rv); |
1480 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1481 | 0 | return false; |
1482 | 0 | } |
1483 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1484 | 0 | JS::ExposeObjectToActiveJS(result); |
1485 | 0 | args.rval().setObject(*result); |
1486 | 0 | if (!MaybeWrapObjectValue(cx, args.rval())) { |
1487 | 0 | return false; |
1488 | 0 | } |
1489 | 0 | return true; |
1490 | 0 | } |
1491 | | |
1492 | | static const JSJitInfo next_methodinfo = { |
1493 | | { (JSJitGetterOp)next }, |
1494 | | { prototypes::id::URLSearchParamsIterator }, |
1495 | | { PrototypeTraits<prototypes::id::URLSearchParamsIterator>::Depth }, |
1496 | | JSJitInfo::Method, |
1497 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1498 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
1499 | | false, /* isInfallible. False in setters. */ |
1500 | | false, /* isMovable. Not relevant for setters. */ |
1501 | | false, /* isEliminatable. Not relevant for setters. */ |
1502 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1503 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1504 | | false, /* isTypedMethod. Only relevant for methods. */ |
1505 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1506 | | }; |
1507 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1508 | | static_assert(0 < 1, "There is no slot for us"); |
1509 | | |
1510 | | static void |
1511 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1512 | 0 | { |
1513 | 0 | mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>>(obj); |
1514 | 0 | if (self) { |
1515 | 0 | AddForDeferredFinalization<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>>(self); |
1516 | 0 | } |
1517 | 0 | } |
1518 | | |
1519 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1520 | | #if defined(__clang__) |
1521 | | #pragma clang diagnostic push |
1522 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1523 | | #endif |
1524 | | static const JSFunctionSpec sMethods_specs[] = { |
1525 | | JS_FNSPEC("next", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&next_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1526 | | JS_FS_END |
1527 | | }; |
1528 | | #if defined(__clang__) |
1529 | | #pragma clang diagnostic pop |
1530 | | #endif |
1531 | | |
1532 | | |
1533 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1534 | | { nullptr, &sMethods_specs[0] }, |
1535 | | { nullptr, nullptr } |
1536 | | }; |
1537 | | |
1538 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1539 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1540 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1541 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1542 | | |
1543 | | |
1544 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
1545 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
1546 | | |
1547 | | static const NativePropertiesN<1> sNativeProperties = { |
1548 | | false, 0, |
1549 | | false, 0, |
1550 | | true, 0 /* sMethods */, |
1551 | | false, 0, |
1552 | | false, 0, |
1553 | | false, 0, |
1554 | | false, 0, |
1555 | | -1, |
1556 | | 1, |
1557 | | sNativeProperties_sortedPropertyIndices, |
1558 | | { |
1559 | | { sMethods, &sNativeProperties_propertyInfos[0] } |
1560 | | } |
1561 | | }; |
1562 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1563 | | "We have a property info count that is oversized"); |
1564 | | |
1565 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1566 | | { |
1567 | | "URLSearchParams IteratorPrototype", |
1568 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1569 | | JS_NULL_CLASS_OPS, |
1570 | | JS_NULL_CLASS_SPEC, |
1571 | | JS_NULL_CLASS_EXT, |
1572 | | JS_NULL_OBJECT_OPS |
1573 | | }, |
1574 | | eInterfacePrototype, |
1575 | | false, |
1576 | | prototypes::id::URLSearchParamsIterator, |
1577 | | PrototypeTraits<prototypes::id::URLSearchParamsIterator>::Depth, |
1578 | | sNativePropertyHooks, |
1579 | | "[object URLSearchParams IteratorPrototype]", |
1580 | | JS::GetRealmIteratorPrototype |
1581 | | }; |
1582 | | |
1583 | | static const js::ClassOps sClassOps = { |
1584 | | nullptr, /* addProperty */ |
1585 | | nullptr, /* delProperty */ |
1586 | | nullptr, /* enumerate */ |
1587 | | nullptr, /* newEnumerate */ |
1588 | | nullptr, /* resolve */ |
1589 | | nullptr, /* mayResolve */ |
1590 | | _finalize, /* finalize */ |
1591 | | nullptr, /* call */ |
1592 | | nullptr, /* hasInstance */ |
1593 | | nullptr, /* construct */ |
1594 | | nullptr, /* trace */ |
1595 | | }; |
1596 | | |
1597 | | static const js::ClassExtension sClassExtension = { |
1598 | | nullptr, /* weakmapKeyDelegateOp */ |
1599 | | nullptr /* objectMovedOp */ |
1600 | | }; |
1601 | | |
1602 | | static const DOMJSClass sClass = { |
1603 | | { "URLSearchParams Iterator", |
1604 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1605 | | &sClassOps, |
1606 | | JS_NULL_CLASS_SPEC, |
1607 | | &sClassExtension, |
1608 | | JS_NULL_OBJECT_OPS |
1609 | | }, |
1610 | | { prototypes::id::URLSearchParamsIterator, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1611 | | IsBaseOf<nsISupports, mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> >::value, |
1612 | | sNativePropertyHooks, |
1613 | | FindAssociatedGlobalForNative<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>>::Get, |
1614 | | GetProtoObjectHandle, |
1615 | | GetCCParticipant<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>>::Get() |
1616 | | }; |
1617 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1618 | | "Must have the right minimal number of reserved slots."); |
1619 | | static_assert(1 >= 1, |
1620 | | "Must have enough reserved slots."); |
1621 | | |
1622 | | const JSClass* |
1623 | | GetJSClass() |
1624 | 0 | { |
1625 | 0 | return sClass.ToJSClass(); |
1626 | 0 | } |
1627 | | |
1628 | | bool |
1629 | | Wrap(JSContext* aCx, mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1630 | 0 | { |
1631 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>*>(aObject) == |
1632 | 0 | reinterpret_cast<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>*>(aObject), |
1633 | 0 | "Multiple inheritance for mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> is broken."); |
1634 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1635 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1636 | 0 |
|
1637 | 0 | JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx)); |
1638 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1639 | 0 | if (!canonicalProto) { |
1640 | 0 | return false; |
1641 | 0 | } |
1642 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1643 | 0 | if (aGivenProto) { |
1644 | 0 | proto = aGivenProto; |
1645 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1646 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1647 | 0 | // to wrap the proto here. |
1648 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1649 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1650 | 0 | return false; |
1651 | 0 | } |
1652 | 0 | } |
1653 | 0 | } else { |
1654 | 0 | proto = canonicalProto; |
1655 | 0 | } |
1656 | 0 |
|
1657 | 0 | BindingJSObjectCreator<mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>> creator(aCx); |
1658 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1659 | 0 | if (!aReflector) { |
1660 | 0 | return false; |
1661 | 0 | } |
1662 | 0 | |
1663 | 0 | |
1664 | 0 | |
1665 | 0 | creator.InitializationSucceeded(); |
1666 | 0 | return true; |
1667 | 0 | } |
1668 | | |
1669 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1670 | | nullptr, |
1671 | | nullptr, |
1672 | | nullptr, |
1673 | | { sNativeProperties.Upcast(), nullptr }, |
1674 | | prototypes::id::URLSearchParamsIterator, |
1675 | | constructors::id::_ID_Count, |
1676 | | nullptr, |
1677 | | &DefaultXrayExpandoObjectClass |
1678 | | } }; |
1679 | | |
1680 | | void |
1681 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1682 | 0 | { |
1683 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmIteratorPrototype(aCx)); |
1684 | 0 | if (!parentProto) { |
1685 | 0 | return; |
1686 | 0 | } |
1687 | 0 | |
1688 | 0 | static bool sIdsInited = false; |
1689 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1690 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1691 | 0 | return; |
1692 | 0 | } |
1693 | 0 | sIdsInited = true; |
1694 | 0 | } |
1695 | 0 |
|
1696 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::URLSearchParamsIterator); |
1697 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
1698 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1699 | 0 | &sPrototypeClass.mBase, protoCache, |
1700 | 0 | "URLSearchParams Iterator", |
1701 | 0 | nullptr, nullptr, 0, nullptr, |
1702 | 0 | interfaceCache, |
1703 | 0 | sNativeProperties.Upcast(), |
1704 | 0 | nullptr, |
1705 | 0 | nullptr, aDefineOnGlobal, |
1706 | 0 | nullptr, |
1707 | 0 | false); |
1708 | 0 | } |
1709 | | |
1710 | | } // namespace URLSearchParamsIterator_Binding |
1711 | | |
1712 | | |
1713 | | |
1714 | | } // namespace dom |
1715 | | } // namespace mozilla |