Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGTextContentElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGTextContentElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGGraphicsElementBinding.h"
4
#include "SVGTextContentElementBinding.h"
5
#include "WrapperFactory.h"
6
#include "mozilla/FloatingPoint.h"
7
#include "mozilla/OwningNonNull.h"
8
#include "mozilla/dom/BindingUtils.h"
9
#include "mozilla/dom/DOMJSClass.h"
10
#include "mozilla/dom/NonRefcountedDOMObject.h"
11
#include "mozilla/dom/PrimitiveConversions.h"
12
#include "mozilla/dom/SVGAnimatedEnumeration.h"
13
#include "mozilla/dom/SVGAnimatedLength.h"
14
#include "mozilla/dom/SVGIRect.h"
15
#include "mozilla/dom/SVGTextContentElement.h"
16
#include "mozilla/dom/XrayExpandoClass.h"
17
#include "nsISVGPoint.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
namespace binding_detail {}; // Just to make sure it's known as a namespace
23
using namespace mozilla::dom::binding_detail;
24
25
26
namespace SVGTextContentElement_Binding {
27
28
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElement_Binding::NativeType>::value,
29
              "Can't inherit from an interface with a different ownership model.");
30
31
MOZ_CAN_RUN_SCRIPT static bool
32
get_textLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, JSJitGetterCallArgs args)
33
0
{
34
0
  AUTO_PROFILER_LABEL_FAST("get SVGTextContentElement.textLength", DOM, cx);
35
0
36
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->TextLength()));
37
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
38
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
39
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
40
0
    return false;
41
0
  }
42
0
  return true;
43
0
}
44
45
static const JSJitInfo textLength_getterinfo = {
46
  { (JSJitGetterOp)get_textLength },
47
  { prototypes::id::SVGTextContentElement },
48
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
49
  JSJitInfo::Getter,
50
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
51
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
52
  false,  /* isInfallible. False in setters. */
53
  true,  /* isMovable.  Not relevant for setters. */
54
  true, /* isEliminatable.  Not relevant for setters. */
55
  false, /* isAlwaysInSlot.  Only relevant for getters. */
56
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
57
  false,  /* isTypedMethod.  Only relevant for methods. */
58
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
59
};
60
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
61
static_assert(0 < 1, "There is no slot for us");
62
63
MOZ_CAN_RUN_SCRIPT static bool
64
get_lengthAdjust(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, JSJitGetterCallArgs args)
65
0
{
66
0
  AUTO_PROFILER_LABEL_FAST("get SVGTextContentElement.lengthAdjust", DOM, cx);
67
0
68
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->LengthAdjust()));
69
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
70
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
71
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
72
0
    return false;
73
0
  }
74
0
  return true;
75
0
}
76
77
static const JSJitInfo lengthAdjust_getterinfo = {
78
  { (JSJitGetterOp)get_lengthAdjust },
79
  { prototypes::id::SVGTextContentElement },
80
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
81
  JSJitInfo::Getter,
82
  JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
83
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
84
  false,  /* isInfallible. False in setters. */
85
  true,  /* isMovable.  Not relevant for setters. */
86
  true, /* isEliminatable.  Not relevant for setters. */
87
  false, /* isAlwaysInSlot.  Only relevant for getters. */
88
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
89
  false,  /* isTypedMethod.  Only relevant for methods. */
90
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
91
};
92
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
93
static_assert(0 < 1, "There is no slot for us");
94
95
MOZ_CAN_RUN_SCRIPT static bool
96
getNumberOfChars(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
97
0
{
98
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getNumberOfChars", DOM, cx);
99
0
100
0
  int32_t result(self->GetNumberOfChars());
101
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
102
0
  args.rval().setInt32(int32_t(result));
103
0
  return true;
104
0
}
105
106
static const JSJitInfo getNumberOfChars_methodinfo = {
107
  { (JSJitGetterOp)getNumberOfChars },
108
  { prototypes::id::SVGTextContentElement },
109
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
110
  JSJitInfo::Method,
111
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
112
  JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
113
  true,  /* isInfallible. False in setters. */
114
  false,  /* isMovable.  Not relevant for setters. */
115
  false, /* isEliminatable.  Not relevant for setters. */
116
  false, /* isAlwaysInSlot.  Only relevant for getters. */
117
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
118
  false,  /* isTypedMethod.  Only relevant for methods. */
119
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
120
};
121
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
122
static_assert(0 < 1, "There is no slot for us");
123
124
MOZ_CAN_RUN_SCRIPT static bool
125
getComputedTextLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
126
0
{
127
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getComputedTextLength", DOM, cx);
128
0
129
0
  float result(self->GetComputedTextLength());
130
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
131
0
  args.rval().set(JS_NumberValue(double(result)));
132
0
  return true;
133
0
}
134
135
static const JSJitInfo getComputedTextLength_methodinfo = {
136
  { (JSJitGetterOp)getComputedTextLength },
137
  { prototypes::id::SVGTextContentElement },
138
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
139
  JSJitInfo::Method,
140
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
141
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
142
  true,  /* isInfallible. False in setters. */
143
  false,  /* isMovable.  Not relevant for setters. */
144
  false, /* isEliminatable.  Not relevant for setters. */
145
  false, /* isAlwaysInSlot.  Only relevant for getters. */
146
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
147
  false,  /* isTypedMethod.  Only relevant for methods. */
148
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
149
};
150
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
151
static_assert(0 < 1, "There is no slot for us");
152
153
MOZ_CAN_RUN_SCRIPT static bool
154
getSubStringLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
155
0
{
156
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getSubStringLength", DOM, cx);
157
0
158
0
  if (MOZ_UNLIKELY(args.length() < 2)) {
159
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getSubStringLength");
160
0
  }
161
0
  uint32_t arg0;
162
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
163
0
    return false;
164
0
  }
165
0
  uint32_t arg1;
166
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
167
0
    return false;
168
0
  }
169
0
  FastErrorResult rv;
170
0
  float result(self->GetSubStringLength(arg0, arg1, rv));
171
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
172
0
    return false;
173
0
  }
174
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
175
0
  args.rval().set(JS_NumberValue(double(result)));
176
0
  return true;
177
0
}
178
179
static const JSJitInfo getSubStringLength_methodinfo = {
180
  { (JSJitGetterOp)getSubStringLength },
181
  { prototypes::id::SVGTextContentElement },
182
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
183
  JSJitInfo::Method,
184
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
185
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
186
  false,  /* isInfallible. False in setters. */
187
  false,  /* isMovable.  Not relevant for setters. */
188
  false, /* isEliminatable.  Not relevant for setters. */
189
  false, /* isAlwaysInSlot.  Only relevant for getters. */
190
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
191
  false,  /* isTypedMethod.  Only relevant for methods. */
192
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
193
};
194
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
195
static_assert(0 < 1, "There is no slot for us");
196
197
MOZ_CAN_RUN_SCRIPT static bool
198
getStartPositionOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
199
0
{
200
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getStartPositionOfChar", DOM, cx);
201
0
202
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
203
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getStartPositionOfChar");
204
0
  }
205
0
  uint32_t arg0;
206
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
207
0
    return false;
208
0
  }
209
0
  FastErrorResult rv;
210
0
  auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->GetStartPositionOfChar(arg0, rv)));
211
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
212
0
    return false;
213
0
  }
214
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
215
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
216
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
217
0
    return false;
218
0
  }
219
0
  return true;
220
0
}
221
222
static const JSJitInfo getStartPositionOfChar_methodinfo = {
223
  { (JSJitGetterOp)getStartPositionOfChar },
224
  { prototypes::id::SVGTextContentElement },
225
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
226
  JSJitInfo::Method,
227
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
228
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
229
  false,  /* isInfallible. False in setters. */
230
  false,  /* isMovable.  Not relevant for setters. */
231
  false, /* isEliminatable.  Not relevant for setters. */
232
  false, /* isAlwaysInSlot.  Only relevant for getters. */
233
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
234
  false,  /* isTypedMethod.  Only relevant for methods. */
235
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
236
};
237
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
238
static_assert(0 < 1, "There is no slot for us");
239
240
MOZ_CAN_RUN_SCRIPT static bool
241
getEndPositionOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
242
0
{
243
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getEndPositionOfChar", DOM, cx);
244
0
245
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
246
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getEndPositionOfChar");
247
0
  }
248
0
  uint32_t arg0;
249
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
250
0
    return false;
251
0
  }
252
0
  FastErrorResult rv;
253
0
  auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->GetEndPositionOfChar(arg0, rv)));
254
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
255
0
    return false;
256
0
  }
257
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
258
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
259
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
260
0
    return false;
261
0
  }
262
0
  return true;
263
0
}
264
265
static const JSJitInfo getEndPositionOfChar_methodinfo = {
266
  { (JSJitGetterOp)getEndPositionOfChar },
267
  { prototypes::id::SVGTextContentElement },
268
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
269
  JSJitInfo::Method,
270
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
271
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
272
  false,  /* isInfallible. False in setters. */
273
  false,  /* isMovable.  Not relevant for setters. */
274
  false, /* isEliminatable.  Not relevant for setters. */
275
  false, /* isAlwaysInSlot.  Only relevant for getters. */
276
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
277
  false,  /* isTypedMethod.  Only relevant for methods. */
278
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
279
};
280
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
281
static_assert(0 < 1, "There is no slot for us");
282
283
MOZ_CAN_RUN_SCRIPT static bool
284
getExtentOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
285
0
{
286
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getExtentOfChar", DOM, cx);
287
0
288
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
289
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getExtentOfChar");
290
0
  }
291
0
  uint32_t arg0;
292
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
293
0
    return false;
294
0
  }
295
0
  FastErrorResult rv;
296
0
  auto result(StrongOrRawPtr<mozilla::dom::SVGIRect>(self->GetExtentOfChar(arg0, rv)));
297
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
298
0
    return false;
299
0
  }
300
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
301
0
  static_assert(!IsPointer<decltype(result)>::value,
302
0
                "NewObject implies that we need to keep the object alive with a strong reference.");
303
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
304
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
305
0
    return false;
306
0
  }
307
0
  return true;
308
0
}
309
310
static const JSJitInfo getExtentOfChar_methodinfo = {
311
  { (JSJitGetterOp)getExtentOfChar },
312
  { prototypes::id::SVGTextContentElement },
313
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
314
  JSJitInfo::Method,
315
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
316
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
317
  false,  /* isInfallible. False in setters. */
318
  false,  /* isMovable.  Not relevant for setters. */
319
  false, /* isEliminatable.  Not relevant for setters. */
320
  false, /* isAlwaysInSlot.  Only relevant for getters. */
321
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
322
  false,  /* isTypedMethod.  Only relevant for methods. */
323
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
324
};
325
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
326
static_assert(0 < 1, "There is no slot for us");
327
328
MOZ_CAN_RUN_SCRIPT static bool
329
getRotationOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
330
0
{
331
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getRotationOfChar", DOM, cx);
332
0
333
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
334
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getRotationOfChar");
335
0
  }
336
0
  uint32_t arg0;
337
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
338
0
    return false;
339
0
  }
340
0
  FastErrorResult rv;
341
0
  float result(self->GetRotationOfChar(arg0, rv));
342
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
343
0
    return false;
344
0
  }
345
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
346
0
  args.rval().set(JS_NumberValue(double(result)));
347
0
  return true;
348
0
}
349
350
static const JSJitInfo getRotationOfChar_methodinfo = {
351
  { (JSJitGetterOp)getRotationOfChar },
352
  { prototypes::id::SVGTextContentElement },
353
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
354
  JSJitInfo::Method,
355
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
356
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
357
  false,  /* isInfallible. False in setters. */
358
  false,  /* isMovable.  Not relevant for setters. */
359
  false, /* isEliminatable.  Not relevant for setters. */
360
  false, /* isAlwaysInSlot.  Only relevant for getters. */
361
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
362
  false,  /* isTypedMethod.  Only relevant for methods. */
363
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
364
};
365
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
366
static_assert(0 < 1, "There is no slot for us");
367
368
MOZ_CAN_RUN_SCRIPT static bool
369
getCharNumAtPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
370
0
{
371
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.getCharNumAtPosition", DOM, cx);
372
0
373
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
374
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getCharNumAtPosition");
375
0
  }
376
0
  NonNull<mozilla::nsISVGPoint> arg0;
377
0
  if (args[0].isObject()) {
378
0
    {
379
0
      nsresult rv = UnwrapObject<prototypes::id::SVGPoint, mozilla::nsISVGPoint>(args[0], arg0);
380
0
      if (NS_FAILED(rv)) {
381
0
        ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGTextContentElement.getCharNumAtPosition", "SVGPoint");
382
0
        return false;
383
0
      }
384
0
    }
385
0
  } else {
386
0
    ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGTextContentElement.getCharNumAtPosition");
387
0
    return false;
388
0
  }
389
0
  int32_t result(self->GetCharNumAtPosition(MOZ_KnownLive(NonNullHelper(arg0))));
390
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
391
0
  args.rval().setInt32(int32_t(result));
392
0
  return true;
393
0
}
394
395
static const JSJitInfo getCharNumAtPosition_methodinfo = {
396
  { (JSJitGetterOp)getCharNumAtPosition },
397
  { prototypes::id::SVGTextContentElement },
398
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
399
  JSJitInfo::Method,
400
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
401
  JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
402
  false,  /* isInfallible. False in setters. */
403
  false,  /* isMovable.  Not relevant for setters. */
404
  false, /* isEliminatable.  Not relevant for setters. */
405
  false, /* isAlwaysInSlot.  Only relevant for getters. */
406
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
407
  false,  /* isTypedMethod.  Only relevant for methods. */
408
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
409
};
410
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
411
static_assert(0 < 1, "There is no slot for us");
412
413
MOZ_CAN_RUN_SCRIPT static bool
414
selectSubString(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
415
0
{
416
0
  AUTO_PROFILER_LABEL_FAST("SVGTextContentElement.selectSubString", DOM, cx);
417
0
418
0
  if (MOZ_UNLIKELY(args.length() < 2)) {
419
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.selectSubString");
420
0
  }
421
0
  uint32_t arg0;
422
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
423
0
    return false;
424
0
  }
425
0
  uint32_t arg1;
426
0
  if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
427
0
    return false;
428
0
  }
429
0
  FastErrorResult rv;
430
0
  self->SelectSubString(arg0, arg1, rv);
431
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
432
0
    return false;
433
0
  }
434
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
435
0
  args.rval().setUndefined();
436
0
  return true;
437
0
}
438
439
static const JSJitInfo selectSubString_methodinfo = {
440
  { (JSJitGetterOp)selectSubString },
441
  { prototypes::id::SVGTextContentElement },
442
  { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
443
  JSJitInfo::Method,
444
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
445
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
446
  false,  /* isInfallible. False in setters. */
447
  false,  /* isMovable.  Not relevant for setters. */
448
  false, /* isEliminatable.  Not relevant for setters. */
449
  false, /* isAlwaysInSlot.  Only relevant for getters. */
450
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
451
  false,  /* isTypedMethod.  Only relevant for methods. */
452
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
453
};
454
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
455
static_assert(0 < 1, "There is no slot for us");
456
457
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
458
#if defined(__clang__)
459
#pragma clang diagnostic push
460
#pragma clang diagnostic ignored "-Wmissing-braces"
461
#endif
462
static const JSFunctionSpec sMethods_specs[] = {
463
  JS_FNSPEC("getNumberOfChars", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getNumberOfChars_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
464
  JS_FNSPEC("getComputedTextLength", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getComputedTextLength_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
465
  JS_FNSPEC("getSubStringLength", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getSubStringLength_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
466
  JS_FNSPEC("getStartPositionOfChar", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getStartPositionOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
467
  JS_FNSPEC("getEndPositionOfChar", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getEndPositionOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
468
  JS_FNSPEC("getExtentOfChar", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getExtentOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
469
  JS_FNSPEC("getRotationOfChar", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRotationOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
470
  JS_FNSPEC("getCharNumAtPosition", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCharNumAtPosition_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
471
  JS_FNSPEC("selectSubString", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&selectSubString_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
472
  JS_FS_END
473
};
474
#if defined(__clang__)
475
#pragma clang diagnostic pop
476
#endif
477
478
479
static const Prefable<const JSFunctionSpec> sMethods[] = {
480
  { nullptr, &sMethods_specs[0] },
481
  { nullptr, nullptr }
482
};
483
484
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
485
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
486
static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
487
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
488
489
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
490
#if defined(__clang__)
491
#pragma clang diagnostic push
492
#pragma clang diagnostic ignored "-Wmissing-braces"
493
#endif
494
static const JSPropertySpec sAttributes_specs[] = {
495
  { "textLength", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &textLength_getterinfo, nullptr, nullptr },
496
  { "lengthAdjust", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &lengthAdjust_getterinfo, nullptr, nullptr },
497
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
498
};
499
#if defined(__clang__)
500
#pragma clang diagnostic pop
501
#endif
502
503
504
static const Prefable<const JSPropertySpec> sAttributes[] = {
505
  { nullptr, &sAttributes_specs[0] },
506
  { nullptr, nullptr }
507
};
508
509
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
510
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
511
static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
512
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
513
514
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
515
#if defined(__clang__)
516
#pragma clang diagnostic push
517
#pragma clang diagnostic ignored "-Wmissing-braces"
518
#endif
519
static const ConstantSpec sConstants_specs[] = {
520
  { "LENGTHADJUST_UNKNOWN", JS::Int32Value(0) },
521
  { "LENGTHADJUST_SPACING", JS::Int32Value(1) },
522
  { "LENGTHADJUST_SPACINGANDGLYPHS", JS::Int32Value(2) },
523
  { 0, JS::UndefinedValue() }
524
};
525
#if defined(__clang__)
526
#pragma clang diagnostic pop
527
#endif
528
529
530
static const Prefable<const ConstantSpec> sConstants[] = {
531
  { nullptr, &sConstants_specs[0] },
532
  { nullptr, nullptr }
533
};
534
535
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
536
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
537
static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
538
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
539
540
541
static uint16_t sNativeProperties_sortedPropertyIndices[14];
542
static PropertyInfo sNativeProperties_propertyInfos[14];
543
544
static const NativePropertiesN<3> sNativeProperties = {
545
  false, 0,
546
  false, 0,
547
  true,  0 /* sMethods */,
548
  true,  1 /* sAttributes */,
549
  false, 0,
550
  false, 0,
551
  true,  2 /* sConstants */,
552
  -1,
553
  14,
554
  sNativeProperties_sortedPropertyIndices,
555
  {
556
    { sMethods, &sNativeProperties_propertyInfos[0] },
557
    { sAttributes, &sNativeProperties_propertyInfos[9] },
558
    { sConstants, &sNativeProperties_propertyInfos[11] }
559
  }
560
};
561
static_assert(14 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
562
    "We have a property info count that is oversized");
563
564
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
565
  {
566
    "Function",
567
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
568
    &sBoringInterfaceObjectClassClassOps,
569
    JS_NULL_CLASS_SPEC,
570
    JS_NULL_CLASS_EXT,
571
    &sInterfaceObjectClassObjectOps
572
  },
573
  eInterface,
574
  true,
575
  prototypes::id::SVGTextContentElement,
576
  PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth,
577
  sNativePropertyHooks,
578
  "function SVGTextContentElement() {\n    [native code]\n}",
579
  SVGGraphicsElement_Binding::GetConstructorObject
580
};
581
582
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
583
  {
584
    "SVGTextContentElementPrototype",
585
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
586
    JS_NULL_CLASS_OPS,
587
    JS_NULL_CLASS_SPEC,
588
    JS_NULL_CLASS_EXT,
589
    JS_NULL_OBJECT_OPS
590
  },
591
  eInterfacePrototype,
592
  false,
593
  prototypes::id::SVGTextContentElement,
594
  PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth,
595
  sNativePropertyHooks,
596
  "[object SVGTextContentElementPrototype]",
597
  SVGGraphicsElement_Binding::GetProtoObject
598
};
599
600
const NativePropertyHooks sNativePropertyHooks[] = { {
601
  nullptr,
602
  nullptr,
603
  nullptr,
604
  { sNativeProperties.Upcast(), nullptr },
605
  prototypes::id::SVGTextContentElement,
606
  constructors::id::SVGTextContentElement,
607
  SVGGraphicsElement_Binding::sNativePropertyHooks,
608
  &DefaultXrayExpandoObjectClass
609
} };
610
611
void
612
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
613
0
{
614
0
  JS::Handle<JSObject*> parentProto(SVGGraphicsElement_Binding::GetProtoObjectHandle(aCx));
615
0
  if (!parentProto) {
616
0
    return;
617
0
  }
618
0
619
0
  JS::Handle<JSObject*> constructorProto(SVGGraphicsElement_Binding::GetConstructorObjectHandle(aCx));
620
0
  if (!constructorProto) {
621
0
    return;
622
0
  }
623
0
624
0
  static bool sIdsInited = false;
625
0
  if (!sIdsInited && NS_IsMainThread()) {
626
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
627
0
      return;
628
0
    }
629
0
    sIdsInited = true;
630
0
  }
631
0
632
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGTextContentElement);
633
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGTextContentElement);
634
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
635
0
                              &sPrototypeClass.mBase, protoCache,
636
0
                              nullptr,
637
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
638
0
                              interfaceCache,
639
0
                              sNativeProperties.Upcast(),
640
0
                              nullptr,
641
0
                              "SVGTextContentElement", aDefineOnGlobal,
642
0
                              nullptr,
643
0
                              false);
644
0
}
645
646
JSObject*
647
GetProtoObject(JSContext* aCx)
648
0
{
649
0
  return GetProtoObjectHandle(aCx);
650
0
}
651
652
JSObject*
653
GetConstructorObject(JSContext* aCx)
654
0
{
655
0
  return GetConstructorObjectHandle(aCx);
656
0
}
657
658
} // namespace SVGTextContentElement_Binding
659
660
661
662
} // namespace dom
663
} // namespace mozilla