Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/HTMLLinkElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM HTMLLinkElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "HTMLElementBinding.h"
4
#include "HTMLLinkElementBinding.h"
5
#include "WrapperFactory.h"
6
#include "mozilla/OwningNonNull.h"
7
#include "mozilla/StyleSheetInlines.h"
8
#include "mozilla/dom/BindingUtils.h"
9
#include "mozilla/dom/CustomElementRegistry.h"
10
#include "mozilla/dom/DOMJSClass.h"
11
#include "mozilla/dom/DocGroup.h"
12
#include "mozilla/dom/HTMLLinkElement.h"
13
#include "mozilla/dom/NonRefcountedDOMObject.h"
14
#include "mozilla/dom/Nullable.h"
15
#include "mozilla/dom/PrimitiveConversions.h"
16
#include "mozilla/dom/XrayExpandoClass.h"
17
#include "nsContentUtils.h"
18
#include "nsDOMTokenList.h"
19
20
namespace mozilla {
21
namespace dom {
22
23
namespace binding_detail {}; // Just to make sure it's known as a namespace
24
using namespace mozilla::dom::binding_detail;
25
26
27
namespace HTMLLinkElement_Binding {
28
29
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value,
30
              "Can't inherit from an interface with a different ownership model.");
31
32
MOZ_CAN_RUN_SCRIPT static bool
33
get_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
34
0
{
35
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.disabled", DOM, cx);
36
0
37
0
  bool result(self->Disabled());
38
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
39
0
  args.rval().setBoolean(result);
40
0
  return true;
41
0
}
42
43
MOZ_CAN_RUN_SCRIPT static bool
44
set_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
45
0
{
46
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.disabled", DOM, cx);
47
0
48
0
  bool arg0;
49
0
  if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
50
0
    return false;
51
0
  }
52
0
  self->SetDisabled(arg0);
53
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
54
0
55
0
  return true;
56
0
}
57
58
static const JSJitInfo disabled_getterinfo = {
59
  { (JSJitGetterOp)get_disabled },
60
  { prototypes::id::HTMLLinkElement },
61
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
62
  JSJitInfo::Getter,
63
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
64
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
65
  true,  /* isInfallible. False in setters. */
66
  true,  /* isMovable.  Not relevant for setters. */
67
  true, /* isEliminatable.  Not relevant for setters. */
68
  false, /* isAlwaysInSlot.  Only relevant for getters. */
69
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
70
  false,  /* isTypedMethod.  Only relevant for methods. */
71
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
72
};
73
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
74
static_assert(0 < 1, "There is no slot for us");
75
static const JSJitInfo disabled_setterinfo = {
76
  { (JSJitGetterOp)set_disabled },
77
  { prototypes::id::HTMLLinkElement },
78
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
79
  JSJitInfo::Setter,
80
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
81
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
82
  false,  /* isInfallible. False in setters. */
83
  false,  /* isMovable.  Not relevant for setters. */
84
  false, /* isEliminatable.  Not relevant for setters. */
85
  false, /* isAlwaysInSlot.  Only relevant for getters. */
86
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
87
  false,  /* isTypedMethod.  Only relevant for methods. */
88
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
89
};
90
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
91
static_assert(0 < 1, "There is no slot for us");
92
93
MOZ_CAN_RUN_SCRIPT static bool
94
get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
95
0
{
96
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.href", DOM, cx);
97
0
98
0
  DOMString result;
99
0
  self->GetHref(result);
100
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
101
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
102
0
    return false;
103
0
  }
104
0
  return true;
105
0
}
106
107
MOZ_CAN_RUN_SCRIPT static bool
108
set_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
109
0
{
110
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.href", DOM, cx);
111
0
112
0
  binding_detail::FakeString arg0;
113
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
114
0
    return false;
115
0
  }
116
0
  Maybe<AutoCEReaction> ceReaction;
117
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
118
0
    DocGroup* docGroup = self->GetDocGroup();
119
0
    if (docGroup) {
120
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
121
0
    }
122
0
  }
123
0
  FastErrorResult rv;
124
0
  nsIPrincipal* subjectPrincipal;
125
0
  {
126
0
    JS::Realm* realm = js::GetContextRealm(cx);
127
0
    MOZ_ASSERT(realm);
128
0
    JSPrincipals* principals = JS::GetRealmPrincipals(realm);
129
0
    nsIPrincipal* principal = nsJSPrincipals::get(principals);
130
0
    if (nsContentUtils::IsSystemPrincipal(principal)) {
131
0
      principal = nullptr;
132
0
    }
133
0
134
0
    subjectPrincipal = principal;
135
0
  }
136
0
  self->SetHref(NonNullHelper(Constify(arg0)), subjectPrincipal, rv);
137
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
138
0
    return false;
139
0
  }
140
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
141
0
142
0
  return true;
143
0
}
144
145
static const JSJitInfo href_getterinfo = {
146
  { (JSJitGetterOp)get_href },
147
  { prototypes::id::HTMLLinkElement },
148
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
149
  JSJitInfo::Getter,
150
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
151
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
152
  false,  /* isInfallible. False in setters. */
153
  true,  /* isMovable.  Not relevant for setters. */
154
  true, /* isEliminatable.  Not relevant for setters. */
155
  false, /* isAlwaysInSlot.  Only relevant for getters. */
156
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
157
  false,  /* isTypedMethod.  Only relevant for methods. */
158
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
159
};
160
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
161
static_assert(0 < 1, "There is no slot for us");
162
static const JSJitInfo href_setterinfo = {
163
  { (JSJitGetterOp)set_href },
164
  { prototypes::id::HTMLLinkElement },
165
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
166
  JSJitInfo::Setter,
167
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
168
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
169
  false,  /* isInfallible. False in setters. */
170
  false,  /* isMovable.  Not relevant for setters. */
171
  false, /* isEliminatable.  Not relevant for setters. */
172
  false, /* isAlwaysInSlot.  Only relevant for getters. */
173
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
174
  false,  /* isTypedMethod.  Only relevant for methods. */
175
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
176
};
177
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
178
static_assert(0 < 1, "There is no slot for us");
179
180
MOZ_CAN_RUN_SCRIPT static bool
181
get_crossOrigin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
182
0
{
183
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.crossOrigin", DOM, cx);
184
0
185
0
  DOMString result;
186
0
  self->GetCrossOrigin(result);
187
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
188
0
  if (!xpc::StringToJsval(cx, result, args.rval())) {
189
0
    return false;
190
0
  }
191
0
  return true;
192
0
}
193
194
MOZ_CAN_RUN_SCRIPT static bool
195
set_crossOrigin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
196
0
{
197
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.crossOrigin", DOM, cx);
198
0
199
0
  binding_detail::FakeString arg0;
200
0
  if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
201
0
    return false;
202
0
  }
203
0
  Maybe<AutoCEReaction> ceReaction;
204
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
205
0
    DocGroup* docGroup = self->GetDocGroup();
206
0
    if (docGroup) {
207
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
208
0
    }
209
0
  }
210
0
  FastErrorResult rv;
211
0
  self->SetCrossOrigin(NonNullHelper(Constify(arg0)), rv);
212
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
213
0
    return false;
214
0
  }
215
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
216
0
217
0
  return true;
218
0
}
219
220
static const JSJitInfo crossOrigin_getterinfo = {
221
  { (JSJitGetterOp)get_crossOrigin },
222
  { prototypes::id::HTMLLinkElement },
223
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
224
  JSJitInfo::Getter,
225
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
226
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
227
  false,  /* isInfallible. False in setters. */
228
  true,  /* isMovable.  Not relevant for setters. */
229
  true, /* isEliminatable.  Not relevant for setters. */
230
  false, /* isAlwaysInSlot.  Only relevant for getters. */
231
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
232
  false,  /* isTypedMethod.  Only relevant for methods. */
233
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
234
};
235
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
236
static_assert(0 < 1, "There is no slot for us");
237
static const JSJitInfo crossOrigin_setterinfo = {
238
  { (JSJitGetterOp)set_crossOrigin },
239
  { prototypes::id::HTMLLinkElement },
240
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
241
  JSJitInfo::Setter,
242
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
243
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
244
  false,  /* isInfallible. False in setters. */
245
  false,  /* isMovable.  Not relevant for setters. */
246
  false, /* isEliminatable.  Not relevant for setters. */
247
  false, /* isAlwaysInSlot.  Only relevant for getters. */
248
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
249
  false,  /* isTypedMethod.  Only relevant for methods. */
250
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
251
};
252
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
253
static_assert(0 < 1, "There is no slot for us");
254
255
MOZ_CAN_RUN_SCRIPT static bool
256
get_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
257
0
{
258
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.rel", DOM, cx);
259
0
260
0
  DOMString result;
261
0
  self->GetRel(result);
262
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
263
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
264
0
    return false;
265
0
  }
266
0
  return true;
267
0
}
268
269
MOZ_CAN_RUN_SCRIPT static bool
270
set_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
271
0
{
272
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.rel", DOM, cx);
273
0
274
0
  binding_detail::FakeString arg0;
275
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
276
0
    return false;
277
0
  }
278
0
  Maybe<AutoCEReaction> ceReaction;
279
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
280
0
    DocGroup* docGroup = self->GetDocGroup();
281
0
    if (docGroup) {
282
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
283
0
    }
284
0
  }
285
0
  FastErrorResult rv;
286
0
  self->SetRel(NonNullHelper(Constify(arg0)), rv);
287
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
288
0
    return false;
289
0
  }
290
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
291
0
292
0
  return true;
293
0
}
294
295
static const JSJitInfo rel_getterinfo = {
296
  { (JSJitGetterOp)get_rel },
297
  { prototypes::id::HTMLLinkElement },
298
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
299
  JSJitInfo::Getter,
300
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
301
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
302
  false,  /* isInfallible. False in setters. */
303
  true,  /* isMovable.  Not relevant for setters. */
304
  true, /* isEliminatable.  Not relevant for setters. */
305
  false, /* isAlwaysInSlot.  Only relevant for getters. */
306
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
307
  false,  /* isTypedMethod.  Only relevant for methods. */
308
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
309
};
310
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
311
static_assert(0 < 1, "There is no slot for us");
312
static const JSJitInfo rel_setterinfo = {
313
  { (JSJitGetterOp)set_rel },
314
  { prototypes::id::HTMLLinkElement },
315
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
316
  JSJitInfo::Setter,
317
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
318
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
319
  false,  /* isInfallible. False in setters. */
320
  false,  /* isMovable.  Not relevant for setters. */
321
  false, /* isEliminatable.  Not relevant for setters. */
322
  false, /* isAlwaysInSlot.  Only relevant for getters. */
323
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
324
  false,  /* isTypedMethod.  Only relevant for methods. */
325
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
326
};
327
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
328
static_assert(0 < 1, "There is no slot for us");
329
330
MOZ_CAN_RUN_SCRIPT static bool
331
get_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
332
0
{
333
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.relList", DOM, cx);
334
0
335
0
  auto result(StrongOrRawPtr<nsDOMTokenList>(self->RelList()));
336
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
337
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
338
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
339
0
    return false;
340
0
  }
341
0
  return true;
342
0
}
343
344
MOZ_CAN_RUN_SCRIPT static bool
345
set_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
346
0
{
347
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.relList", DOM, cx);
348
0
349
0
  JS::Rooted<JS::Value> v(cx);
350
0
  if (!JS_GetProperty(cx, obj, "relList", &v)) {
351
0
    return false;
352
0
  }
353
0
354
0
  if (!v.isObject()) {
355
0
    return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "HTMLLinkElement.relList");
356
0
  }
357
0
358
0
  JS::Rooted<JSObject*> targetObj(cx, &v.toObject());
359
0
  return JS_SetProperty(cx, targetObj, "value", args[0]);
360
0
}
361
362
static const JSJitInfo relList_getterinfo = {
363
  { (JSJitGetterOp)get_relList },
364
  { prototypes::id::HTMLLinkElement },
365
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
366
  JSJitInfo::Getter,
367
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
368
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
369
  false,  /* isInfallible. False in setters. */
370
  false,  /* isMovable.  Not relevant for setters. */
371
  false, /* isEliminatable.  Not relevant for setters. */
372
  false, /* isAlwaysInSlot.  Only relevant for getters. */
373
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
374
  false,  /* isTypedMethod.  Only relevant for methods. */
375
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
376
};
377
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
378
static_assert(0 < 1, "There is no slot for us");
379
static const JSJitInfo relList_setterinfo = {
380
  { (JSJitGetterOp)set_relList },
381
  { prototypes::id::HTMLLinkElement },
382
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
383
  JSJitInfo::Setter,
384
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
385
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
386
  false,  /* isInfallible. False in setters. */
387
  false,  /* isMovable.  Not relevant for setters. */
388
  false, /* isEliminatable.  Not relevant for setters. */
389
  false, /* isAlwaysInSlot.  Only relevant for getters. */
390
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
391
  false,  /* isTypedMethod.  Only relevant for methods. */
392
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
393
};
394
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
395
static_assert(0 < 1, "There is no slot for us");
396
397
MOZ_CAN_RUN_SCRIPT static bool
398
get_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
399
0
{
400
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.media", DOM, cx);
401
0
402
0
  DOMString result;
403
0
  self->GetMedia(result);
404
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
405
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
406
0
    return false;
407
0
  }
408
0
  return true;
409
0
}
410
411
MOZ_CAN_RUN_SCRIPT static bool
412
set_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
413
0
{
414
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.media", DOM, cx);
415
0
416
0
  binding_detail::FakeString arg0;
417
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
418
0
    return false;
419
0
  }
420
0
  Maybe<AutoCEReaction> ceReaction;
421
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
422
0
    DocGroup* docGroup = self->GetDocGroup();
423
0
    if (docGroup) {
424
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
425
0
    }
426
0
  }
427
0
  FastErrorResult rv;
428
0
  self->SetMedia(NonNullHelper(Constify(arg0)), rv);
429
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
430
0
    return false;
431
0
  }
432
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
433
0
434
0
  return true;
435
0
}
436
437
static const JSJitInfo media_getterinfo = {
438
  { (JSJitGetterOp)get_media },
439
  { prototypes::id::HTMLLinkElement },
440
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
441
  JSJitInfo::Getter,
442
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
443
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
444
  false,  /* isInfallible. False in setters. */
445
  true,  /* isMovable.  Not relevant for setters. */
446
  true, /* isEliminatable.  Not relevant for setters. */
447
  false, /* isAlwaysInSlot.  Only relevant for getters. */
448
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
449
  false,  /* isTypedMethod.  Only relevant for methods. */
450
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
451
};
452
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
453
static_assert(0 < 1, "There is no slot for us");
454
static const JSJitInfo media_setterinfo = {
455
  { (JSJitGetterOp)set_media },
456
  { prototypes::id::HTMLLinkElement },
457
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
458
  JSJitInfo::Setter,
459
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
460
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
461
  false,  /* isInfallible. False in setters. */
462
  false,  /* isMovable.  Not relevant for setters. */
463
  false, /* isEliminatable.  Not relevant for setters. */
464
  false, /* isAlwaysInSlot.  Only relevant for getters. */
465
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
466
  false,  /* isTypedMethod.  Only relevant for methods. */
467
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
468
};
469
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
470
static_assert(0 < 1, "There is no slot for us");
471
472
MOZ_CAN_RUN_SCRIPT static bool
473
get_hreflang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
474
0
{
475
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.hreflang", DOM, cx);
476
0
477
0
  DOMString result;
478
0
  self->GetHreflang(result);
479
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
480
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
481
0
    return false;
482
0
  }
483
0
  return true;
484
0
}
485
486
MOZ_CAN_RUN_SCRIPT static bool
487
set_hreflang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
488
0
{
489
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.hreflang", DOM, cx);
490
0
491
0
  binding_detail::FakeString arg0;
492
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
493
0
    return false;
494
0
  }
495
0
  Maybe<AutoCEReaction> ceReaction;
496
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
497
0
    DocGroup* docGroup = self->GetDocGroup();
498
0
    if (docGroup) {
499
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
500
0
    }
501
0
  }
502
0
  FastErrorResult rv;
503
0
  self->SetHreflang(NonNullHelper(Constify(arg0)), rv);
504
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
505
0
    return false;
506
0
  }
507
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
508
0
509
0
  return true;
510
0
}
511
512
static const JSJitInfo hreflang_getterinfo = {
513
  { (JSJitGetterOp)get_hreflang },
514
  { prototypes::id::HTMLLinkElement },
515
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
516
  JSJitInfo::Getter,
517
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
518
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
519
  false,  /* isInfallible. False in setters. */
520
  true,  /* isMovable.  Not relevant for setters. */
521
  true, /* isEliminatable.  Not relevant for setters. */
522
  false, /* isAlwaysInSlot.  Only relevant for getters. */
523
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
524
  false,  /* isTypedMethod.  Only relevant for methods. */
525
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
526
};
527
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
528
static_assert(0 < 1, "There is no slot for us");
529
static const JSJitInfo hreflang_setterinfo = {
530
  { (JSJitGetterOp)set_hreflang },
531
  { prototypes::id::HTMLLinkElement },
532
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
533
  JSJitInfo::Setter,
534
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
535
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
536
  false,  /* isInfallible. False in setters. */
537
  false,  /* isMovable.  Not relevant for setters. */
538
  false, /* isEliminatable.  Not relevant for setters. */
539
  false, /* isAlwaysInSlot.  Only relevant for getters. */
540
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
541
  false,  /* isTypedMethod.  Only relevant for methods. */
542
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
543
};
544
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
545
static_assert(0 < 1, "There is no slot for us");
546
547
MOZ_CAN_RUN_SCRIPT static bool
548
get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
549
0
{
550
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.type", DOM, cx);
551
0
552
0
  DOMString result;
553
0
  self->GetType(result);
554
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
555
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
556
0
    return false;
557
0
  }
558
0
  return true;
559
0
}
560
561
MOZ_CAN_RUN_SCRIPT static bool
562
set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
563
0
{
564
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.type", DOM, cx);
565
0
566
0
  binding_detail::FakeString arg0;
567
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
568
0
    return false;
569
0
  }
570
0
  Maybe<AutoCEReaction> ceReaction;
571
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
572
0
    DocGroup* docGroup = self->GetDocGroup();
573
0
    if (docGroup) {
574
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
575
0
    }
576
0
  }
577
0
  FastErrorResult rv;
578
0
  self->SetType(NonNullHelper(Constify(arg0)), rv);
579
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
580
0
    return false;
581
0
  }
582
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
583
0
584
0
  return true;
585
0
}
586
587
static const JSJitInfo type_getterinfo = {
588
  { (JSJitGetterOp)get_type },
589
  { prototypes::id::HTMLLinkElement },
590
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
591
  JSJitInfo::Getter,
592
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
593
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
594
  false,  /* isInfallible. False in setters. */
595
  true,  /* isMovable.  Not relevant for setters. */
596
  true, /* isEliminatable.  Not relevant for setters. */
597
  false, /* isAlwaysInSlot.  Only relevant for getters. */
598
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
599
  false,  /* isTypedMethod.  Only relevant for methods. */
600
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
601
};
602
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
603
static_assert(0 < 1, "There is no slot for us");
604
static const JSJitInfo type_setterinfo = {
605
  { (JSJitGetterOp)set_type },
606
  { prototypes::id::HTMLLinkElement },
607
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
608
  JSJitInfo::Setter,
609
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
610
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
611
  false,  /* isInfallible. False in setters. */
612
  false,  /* isMovable.  Not relevant for setters. */
613
  false, /* isEliminatable.  Not relevant for setters. */
614
  false, /* isAlwaysInSlot.  Only relevant for getters. */
615
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
616
  false,  /* isTypedMethod.  Only relevant for methods. */
617
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
618
};
619
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
620
static_assert(0 < 1, "There is no slot for us");
621
622
MOZ_CAN_RUN_SCRIPT static bool
623
get_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
624
0
{
625
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.referrerPolicy", DOM, cx);
626
0
627
0
  DOMString result;
628
0
  self->GetReferrerPolicy(result);
629
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
630
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
631
0
    return false;
632
0
  }
633
0
  return true;
634
0
}
635
636
MOZ_CAN_RUN_SCRIPT static bool
637
set_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
638
0
{
639
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.referrerPolicy", DOM, cx);
640
0
641
0
  binding_detail::FakeString arg0;
642
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
643
0
    return false;
644
0
  }
645
0
  Maybe<AutoCEReaction> ceReaction;
646
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
647
0
    DocGroup* docGroup = self->GetDocGroup();
648
0
    if (docGroup) {
649
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
650
0
    }
651
0
  }
652
0
  FastErrorResult rv;
653
0
  self->SetReferrerPolicy(NonNullHelper(Constify(arg0)), rv);
654
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
655
0
    return false;
656
0
  }
657
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
658
0
659
0
  return true;
660
0
}
661
662
static const JSJitInfo referrerPolicy_getterinfo = {
663
  { (JSJitGetterOp)get_referrerPolicy },
664
  { prototypes::id::HTMLLinkElement },
665
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
666
  JSJitInfo::Getter,
667
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
668
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
669
  false,  /* isInfallible. False in setters. */
670
  true,  /* isMovable.  Not relevant for setters. */
671
  true, /* isEliminatable.  Not relevant for setters. */
672
  false, /* isAlwaysInSlot.  Only relevant for getters. */
673
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
674
  false,  /* isTypedMethod.  Only relevant for methods. */
675
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
676
};
677
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
678
static_assert(0 < 1, "There is no slot for us");
679
static const JSJitInfo referrerPolicy_setterinfo = {
680
  { (JSJitGetterOp)set_referrerPolicy },
681
  { prototypes::id::HTMLLinkElement },
682
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
683
  JSJitInfo::Setter,
684
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
685
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
686
  false,  /* isInfallible. False in setters. */
687
  false,  /* isMovable.  Not relevant for setters. */
688
  false, /* isEliminatable.  Not relevant for setters. */
689
  false, /* isAlwaysInSlot.  Only relevant for getters. */
690
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
691
  false,  /* isTypedMethod.  Only relevant for methods. */
692
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
693
};
694
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
695
static_assert(0 < 1, "There is no slot for us");
696
697
MOZ_CAN_RUN_SCRIPT static bool
698
get_sizes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
699
0
{
700
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.sizes", DOM, cx);
701
0
702
0
  auto result(StrongOrRawPtr<nsDOMTokenList>(self->Sizes()));
703
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
704
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
705
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
706
0
    return false;
707
0
  }
708
0
  return true;
709
0
}
710
711
MOZ_CAN_RUN_SCRIPT static bool
712
set_sizes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
713
0
{
714
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.sizes", DOM, cx);
715
0
716
0
  JS::Rooted<JS::Value> v(cx);
717
0
  if (!JS_GetProperty(cx, obj, "sizes", &v)) {
718
0
    return false;
719
0
  }
720
0
721
0
  if (!v.isObject()) {
722
0
    return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "HTMLLinkElement.sizes");
723
0
  }
724
0
725
0
  JS::Rooted<JSObject*> targetObj(cx, &v.toObject());
726
0
  return JS_SetProperty(cx, targetObj, "value", args[0]);
727
0
}
728
729
static const JSJitInfo sizes_getterinfo = {
730
  { (JSJitGetterOp)get_sizes },
731
  { prototypes::id::HTMLLinkElement },
732
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
733
  JSJitInfo::Getter,
734
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
735
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
736
  false,  /* isInfallible. False in setters. */
737
  false,  /* isMovable.  Not relevant for setters. */
738
  false, /* isEliminatable.  Not relevant for setters. */
739
  false, /* isAlwaysInSlot.  Only relevant for getters. */
740
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
741
  false,  /* isTypedMethod.  Only relevant for methods. */
742
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
743
};
744
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
745
static_assert(0 < 1, "There is no slot for us");
746
static const JSJitInfo sizes_setterinfo = {
747
  { (JSJitGetterOp)set_sizes },
748
  { prototypes::id::HTMLLinkElement },
749
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
750
  JSJitInfo::Setter,
751
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
752
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
753
  false,  /* isInfallible. False in setters. */
754
  false,  /* isMovable.  Not relevant for setters. */
755
  false, /* isEliminatable.  Not relevant for setters. */
756
  false, /* isAlwaysInSlot.  Only relevant for getters. */
757
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
758
  false,  /* isTypedMethod.  Only relevant for methods. */
759
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
760
};
761
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
762
static_assert(0 < 1, "There is no slot for us");
763
764
MOZ_CAN_RUN_SCRIPT static bool
765
get_charset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
766
0
{
767
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.charset", DOM, cx);
768
0
769
0
  DOMString result;
770
0
  self->GetCharset(result);
771
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
772
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
773
0
    return false;
774
0
  }
775
0
  return true;
776
0
}
777
778
MOZ_CAN_RUN_SCRIPT static bool
779
set_charset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
780
0
{
781
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.charset", DOM, cx);
782
0
783
0
  binding_detail::FakeString arg0;
784
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
785
0
    return false;
786
0
  }
787
0
  Maybe<AutoCEReaction> ceReaction;
788
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
789
0
    DocGroup* docGroup = self->GetDocGroup();
790
0
    if (docGroup) {
791
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
792
0
    }
793
0
  }
794
0
  FastErrorResult rv;
795
0
  self->SetCharset(NonNullHelper(Constify(arg0)), rv);
796
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
797
0
    return false;
798
0
  }
799
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
800
0
801
0
  return true;
802
0
}
803
804
static const JSJitInfo charset_getterinfo = {
805
  { (JSJitGetterOp)get_charset },
806
  { prototypes::id::HTMLLinkElement },
807
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
808
  JSJitInfo::Getter,
809
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
810
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
811
  false,  /* isInfallible. False in setters. */
812
  true,  /* isMovable.  Not relevant for setters. */
813
  true, /* isEliminatable.  Not relevant for setters. */
814
  false, /* isAlwaysInSlot.  Only relevant for getters. */
815
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
816
  false,  /* isTypedMethod.  Only relevant for methods. */
817
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
818
};
819
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
820
static_assert(0 < 1, "There is no slot for us");
821
static const JSJitInfo charset_setterinfo = {
822
  { (JSJitGetterOp)set_charset },
823
  { prototypes::id::HTMLLinkElement },
824
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
825
  JSJitInfo::Setter,
826
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
827
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
828
  false,  /* isInfallible. False in setters. */
829
  false,  /* isMovable.  Not relevant for setters. */
830
  false, /* isEliminatable.  Not relevant for setters. */
831
  false, /* isAlwaysInSlot.  Only relevant for getters. */
832
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
833
  false,  /* isTypedMethod.  Only relevant for methods. */
834
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
835
};
836
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
837
static_assert(0 < 1, "There is no slot for us");
838
839
MOZ_CAN_RUN_SCRIPT static bool
840
get_rev(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
841
0
{
842
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.rev", DOM, cx);
843
0
844
0
  DOMString result;
845
0
  self->GetRev(result);
846
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
847
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
848
0
    return false;
849
0
  }
850
0
  return true;
851
0
}
852
853
MOZ_CAN_RUN_SCRIPT static bool
854
set_rev(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
855
0
{
856
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.rev", DOM, cx);
857
0
858
0
  binding_detail::FakeString arg0;
859
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
860
0
    return false;
861
0
  }
862
0
  Maybe<AutoCEReaction> ceReaction;
863
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
864
0
    DocGroup* docGroup = self->GetDocGroup();
865
0
    if (docGroup) {
866
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
867
0
    }
868
0
  }
869
0
  FastErrorResult rv;
870
0
  self->SetRev(NonNullHelper(Constify(arg0)), rv);
871
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
872
0
    return false;
873
0
  }
874
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
875
0
876
0
  return true;
877
0
}
878
879
static const JSJitInfo rev_getterinfo = {
880
  { (JSJitGetterOp)get_rev },
881
  { prototypes::id::HTMLLinkElement },
882
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
883
  JSJitInfo::Getter,
884
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
885
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
886
  false,  /* isInfallible. False in setters. */
887
  true,  /* isMovable.  Not relevant for setters. */
888
  true, /* isEliminatable.  Not relevant for setters. */
889
  false, /* isAlwaysInSlot.  Only relevant for getters. */
890
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
891
  false,  /* isTypedMethod.  Only relevant for methods. */
892
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
893
};
894
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
895
static_assert(0 < 1, "There is no slot for us");
896
static const JSJitInfo rev_setterinfo = {
897
  { (JSJitGetterOp)set_rev },
898
  { prototypes::id::HTMLLinkElement },
899
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
900
  JSJitInfo::Setter,
901
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
902
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
903
  false,  /* isInfallible. False in setters. */
904
  false,  /* isMovable.  Not relevant for setters. */
905
  false, /* isEliminatable.  Not relevant for setters. */
906
  false, /* isAlwaysInSlot.  Only relevant for getters. */
907
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
908
  false,  /* isTypedMethod.  Only relevant for methods. */
909
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
910
};
911
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
912
static_assert(0 < 1, "There is no slot for us");
913
914
MOZ_CAN_RUN_SCRIPT static bool
915
get_target(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
916
0
{
917
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.target", DOM, cx);
918
0
919
0
  DOMString result;
920
0
  self->GetTarget(result);
921
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
922
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
923
0
    return false;
924
0
  }
925
0
  return true;
926
0
}
927
928
MOZ_CAN_RUN_SCRIPT static bool
929
set_target(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
930
0
{
931
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.target", DOM, cx);
932
0
933
0
  binding_detail::FakeString arg0;
934
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
935
0
    return false;
936
0
  }
937
0
  Maybe<AutoCEReaction> ceReaction;
938
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
939
0
    DocGroup* docGroup = self->GetDocGroup();
940
0
    if (docGroup) {
941
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
942
0
    }
943
0
  }
944
0
  FastErrorResult rv;
945
0
  self->SetTarget(NonNullHelper(Constify(arg0)), rv);
946
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
947
0
    return false;
948
0
  }
949
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
950
0
951
0
  return true;
952
0
}
953
954
static const JSJitInfo target_getterinfo = {
955
  { (JSJitGetterOp)get_target },
956
  { prototypes::id::HTMLLinkElement },
957
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
958
  JSJitInfo::Getter,
959
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
960
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
961
  false,  /* isInfallible. False in setters. */
962
  true,  /* isMovable.  Not relevant for setters. */
963
  true, /* isEliminatable.  Not relevant for setters. */
964
  false, /* isAlwaysInSlot.  Only relevant for getters. */
965
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
966
  false,  /* isTypedMethod.  Only relevant for methods. */
967
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
968
};
969
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
970
static_assert(0 < 1, "There is no slot for us");
971
static const JSJitInfo target_setterinfo = {
972
  { (JSJitGetterOp)set_target },
973
  { prototypes::id::HTMLLinkElement },
974
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
975
  JSJitInfo::Setter,
976
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
977
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
978
  false,  /* isInfallible. False in setters. */
979
  false,  /* isMovable.  Not relevant for setters. */
980
  false, /* isEliminatable.  Not relevant for setters. */
981
  false, /* isAlwaysInSlot.  Only relevant for getters. */
982
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
983
  false,  /* isTypedMethod.  Only relevant for methods. */
984
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
985
};
986
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
987
static_assert(0 < 1, "There is no slot for us");
988
989
MOZ_CAN_RUN_SCRIPT static bool
990
get_integrity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
991
0
{
992
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.integrity", DOM, cx);
993
0
994
0
  DOMString result;
995
0
  self->GetIntegrity(result);
996
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
997
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
998
0
    return false;
999
0
  }
1000
0
  return true;
1001
0
}
1002
1003
MOZ_CAN_RUN_SCRIPT static bool
1004
set_integrity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
1005
0
{
1006
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.integrity", DOM, cx);
1007
0
1008
0
  binding_detail::FakeString arg0;
1009
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1010
0
    return false;
1011
0
  }
1012
0
  Maybe<AutoCEReaction> ceReaction;
1013
0
  if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) {
1014
0
    DocGroup* docGroup = self->GetDocGroup();
1015
0
    if (docGroup) {
1016
0
      ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
1017
0
    }
1018
0
  }
1019
0
  FastErrorResult rv;
1020
0
  self->SetIntegrity(NonNullHelper(Constify(arg0)), rv);
1021
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1022
0
    return false;
1023
0
  }
1024
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1025
0
1026
0
  return true;
1027
0
}
1028
1029
static const JSJitInfo integrity_getterinfo = {
1030
  { (JSJitGetterOp)get_integrity },
1031
  { prototypes::id::HTMLLinkElement },
1032
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
1033
  JSJitInfo::Getter,
1034
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1035
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
1036
  false,  /* isInfallible. False in setters. */
1037
  false,  /* isMovable.  Not relevant for setters. */
1038
  false, /* isEliminatable.  Not relevant for setters. */
1039
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1040
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1041
  false,  /* isTypedMethod.  Only relevant for methods. */
1042
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1043
};
1044
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1045
static_assert(0 < 1, "There is no slot for us");
1046
static const JSJitInfo integrity_setterinfo = {
1047
  { (JSJitGetterOp)set_integrity },
1048
  { prototypes::id::HTMLLinkElement },
1049
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
1050
  JSJitInfo::Setter,
1051
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1052
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1053
  false,  /* isInfallible. False in setters. */
1054
  false,  /* isMovable.  Not relevant for setters. */
1055
  false, /* isEliminatable.  Not relevant for setters. */
1056
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1057
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1058
  false,  /* isTypedMethod.  Only relevant for methods. */
1059
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1060
};
1061
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1062
static_assert(0 < 1, "There is no slot for us");
1063
1064
MOZ_CAN_RUN_SCRIPT static bool
1065
get_as(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
1066
0
{
1067
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.as", DOM, cx);
1068
0
1069
0
  DOMString result;
1070
0
  self->GetAs(result);
1071
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1072
0
  if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1073
0
    return false;
1074
0
  }
1075
0
  return true;
1076
0
}
1077
1078
MOZ_CAN_RUN_SCRIPT static bool
1079
set_as(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitSetterCallArgs args)
1080
0
{
1081
0
  AUTO_PROFILER_LABEL_FAST("set HTMLLinkElement.as", DOM, cx);
1082
0
1083
0
  binding_detail::FakeString arg0;
1084
0
  if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1085
0
    return false;
1086
0
  }
1087
0
  FastErrorResult rv;
1088
0
  self->SetAs(NonNullHelper(Constify(arg0)), rv);
1089
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1090
0
    return false;
1091
0
  }
1092
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1093
0
1094
0
  return true;
1095
0
}
1096
1097
static const JSJitInfo as_getterinfo = {
1098
  { (JSJitGetterOp)get_as },
1099
  { prototypes::id::HTMLLinkElement },
1100
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
1101
  JSJitInfo::Getter,
1102
  JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
1103
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
1104
  false,  /* isInfallible. False in setters. */
1105
  true,  /* isMovable.  Not relevant for setters. */
1106
  true, /* isEliminatable.  Not relevant for setters. */
1107
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1108
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1109
  false,  /* isTypedMethod.  Only relevant for methods. */
1110
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1111
};
1112
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1113
static_assert(0 < 1, "There is no slot for us");
1114
static const JSJitInfo as_setterinfo = {
1115
  { (JSJitGetterOp)set_as },
1116
  { prototypes::id::HTMLLinkElement },
1117
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
1118
  JSJitInfo::Setter,
1119
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1120
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1121
  false,  /* isInfallible. False in setters. */
1122
  false,  /* isMovable.  Not relevant for setters. */
1123
  false, /* isEliminatable.  Not relevant for setters. */
1124
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1125
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1126
  false,  /* isTypedMethod.  Only relevant for methods. */
1127
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1128
};
1129
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1130
static_assert(0 < 1, "There is no slot for us");
1131
1132
MOZ_CAN_RUN_SCRIPT static bool
1133
get_sheet(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLLinkElement* self, JSJitGetterCallArgs args)
1134
0
{
1135
0
  AUTO_PROFILER_LABEL_FAST("get HTMLLinkElement.sheet", DOM, cx);
1136
0
1137
0
  auto result(StrongOrRawPtr<mozilla::StyleSheet>(self->GetSheet()));
1138
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1139
0
  if (!result) {
1140
0
    args.rval().setNull();
1141
0
    return true;
1142
0
  }
1143
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1144
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
1145
0
    return false;
1146
0
  }
1147
0
  return true;
1148
0
}
1149
1150
static const JSJitInfo sheet_getterinfo = {
1151
  { (JSJitGetterOp)get_sheet },
1152
  { prototypes::id::HTMLLinkElement },
1153
  { PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth },
1154
  JSJitInfo::Getter,
1155
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1156
  JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
1157
  false,  /* isInfallible. False in setters. */
1158
  false,  /* isMovable.  Not relevant for setters. */
1159
  false, /* isEliminatable.  Not relevant for setters. */
1160
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1161
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1162
  false,  /* isTypedMethod.  Only relevant for methods. */
1163
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1164
};
1165
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1166
static_assert(0 < 1, "There is no slot for us");
1167
1168
static bool
1169
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1170
0
{
1171
0
  mozilla::dom::HTMLLinkElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLLinkElement>(obj);
1172
0
  // We don't want to preserve if we don't have a wrapper, and we
1173
0
  // obviously can't preserve if we're not initialized.
1174
0
  if (self && self->GetWrapperPreserveColor()) {
1175
0
    PreserveWrapper(self);
1176
0
  }
1177
0
  return true;
1178
0
}
1179
1180
static void
1181
_finalize(js::FreeOp* fop, JSObject* obj)
1182
0
{
1183
0
  mozilla::dom::HTMLLinkElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLLinkElement>(obj);
1184
0
  if (self) {
1185
0
    ClearWrapper(self, self, obj);
1186
0
    AddForDeferredFinalization<mozilla::dom::HTMLLinkElement>(self);
1187
0
  }
1188
0
}
1189
1190
static size_t
1191
_objectMoved(JSObject* obj, JSObject* old)
1192
0
{
1193
0
  mozilla::dom::HTMLLinkElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLLinkElement>(obj);
1194
0
  if (self) {
1195
0
    UpdateWrapper(self, self, obj, old);
1196
0
  }
1197
0
1198
0
  return 0;
1199
0
}
1200
1201
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1202
#if defined(__clang__)
1203
#pragma clang diagnostic push
1204
#pragma clang diagnostic ignored "-Wmissing-braces"
1205
#endif
1206
static const JSPropertySpec sAttributes_specs[] = {
1207
  { "disabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &disabled_getterinfo, GenericSetter<NormalThisPolicy>, &disabled_setterinfo },
1208
  { "href", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &href_getterinfo, GenericSetter<NormalThisPolicy>, &href_setterinfo },
1209
  { "crossOrigin", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &crossOrigin_getterinfo, GenericSetter<NormalThisPolicy>, &crossOrigin_setterinfo },
1210
  { "rel", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rel_getterinfo, GenericSetter<NormalThisPolicy>, &rel_setterinfo },
1211
  { "relList", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &relList_getterinfo, GenericSetter<NormalThisPolicy>, &relList_setterinfo },
1212
  { "media", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &media_getterinfo, GenericSetter<NormalThisPolicy>, &media_setterinfo },
1213
  { "hreflang", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &hreflang_getterinfo, GenericSetter<NormalThisPolicy>, &hreflang_setterinfo },
1214
  { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, GenericSetter<NormalThisPolicy>, &type_setterinfo },
1215
  { "referrerPolicy", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &referrerPolicy_getterinfo, GenericSetter<NormalThisPolicy>, &referrerPolicy_setterinfo },
1216
  { "sizes", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sizes_getterinfo, GenericSetter<NormalThisPolicy>, &sizes_setterinfo },
1217
  { "charset", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &charset_getterinfo, GenericSetter<NormalThisPolicy>, &charset_setterinfo },
1218
  { "rev", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rev_getterinfo, GenericSetter<NormalThisPolicy>, &rev_setterinfo },
1219
  { "target", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &target_getterinfo, GenericSetter<NormalThisPolicy>, &target_setterinfo },
1220
  { "integrity", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &integrity_getterinfo, GenericSetter<NormalThisPolicy>, &integrity_setterinfo },
1221
  { "as", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &as_getterinfo, GenericSetter<NormalThisPolicy>, &as_setterinfo },
1222
  { "sheet", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sheet_getterinfo, nullptr, nullptr },
1223
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1224
};
1225
#if defined(__clang__)
1226
#pragma clang diagnostic pop
1227
#endif
1228
1229
1230
static const Prefable<const JSPropertySpec> sAttributes[] = {
1231
  { nullptr, &sAttributes_specs[0] },
1232
  { nullptr, nullptr }
1233
};
1234
1235
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1236
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1237
static_assert(16 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1238
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1239
1240
1241
static uint16_t sNativeProperties_sortedPropertyIndices[16];
1242
static PropertyInfo sNativeProperties_propertyInfos[16];
1243
1244
static const NativePropertiesN<1> sNativeProperties = {
1245
  false, 0,
1246
  false, 0,
1247
  false, 0,
1248
  true,  0 /* sAttributes */,
1249
  false, 0,
1250
  false, 0,
1251
  false, 0,
1252
  -1,
1253
  16,
1254
  sNativeProperties_sortedPropertyIndices,
1255
  {
1256
    { sAttributes, &sNativeProperties_propertyInfos[0] }
1257
  }
1258
};
1259
static_assert(16 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1260
    "We have a property info count that is oversized");
1261
1262
static bool
1263
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1264
0
{
1265
0
  AUTO_PROFILER_LABEL_FAST("HTMLLinkElement constructor", DOM, cx);
1266
0
1267
0
  return HTMLConstructor(cx, argc, vp,
1268
0
                         constructors::id::HTMLLinkElement,
1269
0
                         prototypes::id::HTMLLinkElement,
1270
0
                         CreateInterfaceObjects);
1271
0
}
1272
1273
static const js::ClassOps sInterfaceObjectClassOps = {
1274
    nullptr,               /* addProperty */
1275
    nullptr,               /* delProperty */
1276
    nullptr,               /* enumerate */
1277
    nullptr,               /* newEnumerate */
1278
    nullptr,               /* resolve */
1279
    nullptr,               /* mayResolve */
1280
    nullptr,               /* finalize */
1281
    _constructor, /* call */
1282
    nullptr,               /* hasInstance */
1283
    _constructor, /* construct */
1284
    nullptr,               /* trace */
1285
};
1286
1287
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1288
  {
1289
    "Function",
1290
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1291
    &sInterfaceObjectClassOps,
1292
    JS_NULL_CLASS_SPEC,
1293
    JS_NULL_CLASS_EXT,
1294
    &sInterfaceObjectClassObjectOps
1295
  },
1296
  eInterface,
1297
  true,
1298
  prototypes::id::HTMLLinkElement,
1299
  PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth,
1300
  sNativePropertyHooks,
1301
  "function HTMLLinkElement() {\n    [native code]\n}",
1302
  HTMLElement_Binding::GetConstructorObject
1303
};
1304
1305
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1306
  {
1307
    "HTMLLinkElementPrototype",
1308
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1309
    JS_NULL_CLASS_OPS,
1310
    JS_NULL_CLASS_SPEC,
1311
    JS_NULL_CLASS_EXT,
1312
    JS_NULL_OBJECT_OPS
1313
  },
1314
  eInterfacePrototype,
1315
  false,
1316
  prototypes::id::HTMLLinkElement,
1317
  PrototypeTraits<prototypes::id::HTMLLinkElement>::Depth,
1318
  sNativePropertyHooks,
1319
  "[object HTMLLinkElementPrototype]",
1320
  HTMLElement_Binding::GetProtoObject
1321
};
1322
1323
static const js::ClassOps sClassOps = {
1324
  _addProperty, /* addProperty */
1325
  nullptr,               /* delProperty */
1326
  nullptr,               /* enumerate */
1327
  nullptr, /* newEnumerate */
1328
  nullptr, /* resolve */
1329
  nullptr, /* mayResolve */
1330
  _finalize, /* finalize */
1331
  nullptr, /* call */
1332
  nullptr,               /* hasInstance */
1333
  nullptr,               /* construct */
1334
  nullptr, /* trace */
1335
};
1336
1337
static const js::ClassExtension sClassExtension = {
1338
  nullptr, /* weakmapKeyDelegateOp */
1339
  _objectMoved /* objectMovedOp */
1340
};
1341
1342
static const DOMJSClass sClass = {
1343
  { "HTMLLinkElement",
1344
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1345
    &sClassOps,
1346
    JS_NULL_CLASS_SPEC,
1347
    &sClassExtension,
1348
    JS_NULL_OBJECT_OPS
1349
  },
1350
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLLinkElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1351
  IsBaseOf<nsISupports, mozilla::dom::HTMLLinkElement >::value,
1352
  sNativePropertyHooks,
1353
  FindAssociatedGlobalForNative<mozilla::dom::HTMLLinkElement>::Get,
1354
  GetProtoObjectHandle,
1355
  GetCCParticipant<mozilla::dom::HTMLLinkElement>::Get()
1356
};
1357
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1358
              "Must have the right minimal number of reserved slots.");
1359
static_assert(1 >= 1,
1360
              "Must have enough reserved slots.");
1361
1362
const JSClass*
1363
GetJSClass()
1364
0
{
1365
0
  return sClass.ToJSClass();
1366
0
}
1367
1368
bool
1369
Wrap(JSContext* aCx, mozilla::dom::HTMLLinkElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1370
0
{
1371
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLLinkElement>::value,
1372
0
                "Shouldn't have wrappercached things that are not refcounted.");
1373
0
  MOZ_ASSERT(static_cast<mozilla::dom::HTMLLinkElement*>(aObject) ==
1374
0
             reinterpret_cast<mozilla::dom::HTMLLinkElement*>(aObject),
1375
0
             "Multiple inheritance for mozilla::dom::HTMLLinkElement is broken.");
1376
0
  MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
1377
0
             reinterpret_cast<nsGenericHTMLElement*>(aObject),
1378
0
             "Multiple inheritance for nsGenericHTMLElement is broken.");
1379
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1380
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
1381
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
1382
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1383
0
             reinterpret_cast<nsINode*>(aObject),
1384
0
             "Multiple inheritance for nsINode is broken.");
1385
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1386
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1387
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1388
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1389
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1390
0
  MOZ_ASSERT(!aCache->GetWrapper(),
1391
0
             "You should probably not be using Wrap() directly; use "
1392
0
             "GetOrCreateDOMReflector instead");
1393
0
1394
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1395
0
             "nsISupports must be on our primary inheritance chain");
1396
0
1397
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1398
0
  if (!global) {
1399
0
    return false;
1400
0
  }
1401
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
1402
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
1403
0
1404
0
  // That might have ended up wrapping us already, due to the wonders
1405
0
  // of XBL.  Check for that, and bail out as needed.
1406
0
  aReflector.set(aCache->GetWrapper());
1407
0
  if (aReflector) {
1408
#ifdef DEBUG
1409
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1410
#endif // DEBUG
1411
    return true;
1412
0
  }
1413
0
1414
0
  JSAutoRealm ar(aCx, global);
1415
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1416
0
  if (!canonicalProto) {
1417
0
    return false;
1418
0
  }
1419
0
  JS::Rooted<JSObject*> proto(aCx);
1420
0
  if (aGivenProto) {
1421
0
    proto = aGivenProto;
1422
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
1423
0
    // coming in, we changed compartments to that of "parent" so may need
1424
0
    // to wrap the proto here.
1425
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1426
0
      if (!JS_WrapObject(aCx, &proto)) {
1427
0
        return false;
1428
0
      }
1429
0
    }
1430
0
  } else {
1431
0
    proto = canonicalProto;
1432
0
  }
1433
0
1434
0
  BindingJSObjectCreator<mozilla::dom::HTMLLinkElement> creator(aCx);
1435
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1436
0
  if (!aReflector) {
1437
0
    return false;
1438
0
  }
1439
0
1440
0
  aCache->SetWrapper(aReflector);
1441
0
  creator.InitializationSucceeded();
1442
0
1443
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1444
0
             aCache->GetWrapperPreserveColor() == aReflector);
1445
0
  // If proto != canonicalProto, we have to preserve our wrapper;
1446
0
  // otherwise we won't be able to properly recreate it later, since
1447
0
  // we won't know what proto to use.  Note that we don't check
1448
0
  // aGivenProto here, since it's entirely possible (and even
1449
0
  // somewhat common) to have a non-null aGivenProto which is the
1450
0
  // same as canonicalProto.
1451
0
  if (proto != canonicalProto) {
1452
0
    PreserveWrapper(aObject);
1453
0
  }
1454
0
1455
0
  return true;
1456
0
}
1457
1458
const NativePropertyHooks sNativePropertyHooks[] = { {
1459
  nullptr,
1460
  nullptr,
1461
  nullptr,
1462
  { sNativeProperties.Upcast(), nullptr },
1463
  prototypes::id::HTMLLinkElement,
1464
  constructors::id::HTMLLinkElement,
1465
  HTMLElement_Binding::sNativePropertyHooks,
1466
  &DefaultXrayExpandoObjectClass
1467
} };
1468
1469
void
1470
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1471
0
{
1472
0
  JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx));
1473
0
  if (!parentProto) {
1474
0
    return;
1475
0
  }
1476
0
1477
0
  JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx));
1478
0
  if (!constructorProto) {
1479
0
    return;
1480
0
  }
1481
0
1482
0
  static bool sIdsInited = false;
1483
0
  if (!sIdsInited && NS_IsMainThread()) {
1484
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
1485
0
      return;
1486
0
    }
1487
0
    sIdsInited = true;
1488
0
  }
1489
0
1490
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLLinkElement);
1491
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLLinkElement);
1492
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1493
0
                              &sPrototypeClass.mBase, protoCache,
1494
0
                              nullptr,
1495
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1496
0
                              interfaceCache,
1497
0
                              sNativeProperties.Upcast(),
1498
0
                              nullptr,
1499
0
                              "HTMLLinkElement", aDefineOnGlobal,
1500
0
                              nullptr,
1501
0
                              false);
1502
0
}
1503
1504
JSObject*
1505
GetConstructorObject(JSContext* aCx)
1506
0
{
1507
0
  return GetConstructorObjectHandle(aCx);
1508
0
}
1509
1510
} // namespace HTMLLinkElement_Binding
1511
1512
1513
1514
} // namespace dom
1515
} // namespace mozilla