Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/SVGFEFuncRElementBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM SVGFEFuncRElement.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "SVGComponentTransferFunctionElementBinding.h"
4
#include "SVGFEFuncRElementBinding.h"
5
#include "WrapperFactory.h"
6
#include "mozilla/OwningNonNull.h"
7
#include "mozilla/dom/BindingUtils.h"
8
#include "mozilla/dom/DOMJSClass.h"
9
#include "mozilla/dom/NonRefcountedDOMObject.h"
10
#include "mozilla/dom/SVGComponentTransferFunctionElement.h"
11
#include "mozilla/dom/XrayExpandoClass.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
namespace binding_detail {}; // Just to make sure it's known as a namespace
17
using namespace mozilla::dom::binding_detail;
18
19
20
namespace SVGFEFuncRElement_Binding {
21
22
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGComponentTransferFunctionElement_Binding::NativeType>::value,
23
              "Can't inherit from an interface with a different ownership model.");
24
25
static bool
26
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
27
0
{
28
0
  mozilla::dom::SVGFEFuncRElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEFuncRElement>(obj);
29
0
  // We don't want to preserve if we don't have a wrapper, and we
30
0
  // obviously can't preserve if we're not initialized.
31
0
  if (self && self->GetWrapperPreserveColor()) {
32
0
    PreserveWrapper(self);
33
0
  }
34
0
  return true;
35
0
}
36
37
static void
38
_finalize(js::FreeOp* fop, JSObject* obj)
39
0
{
40
0
  mozilla::dom::SVGFEFuncRElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEFuncRElement>(obj);
41
0
  if (self) {
42
0
    ClearWrapper(self, self, obj);
43
0
    AddForDeferredFinalization<mozilla::dom::SVGFEFuncRElement>(self);
44
0
  }
45
0
}
46
47
static size_t
48
_objectMoved(JSObject* obj, JSObject* old)
49
0
{
50
0
  mozilla::dom::SVGFEFuncRElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEFuncRElement>(obj);
51
0
  if (self) {
52
0
    UpdateWrapper(self, self, obj, old);
53
0
  }
54
0
55
0
  return 0;
56
0
}
57
58
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
59
  {
60
    "Function",
61
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
62
    &sBoringInterfaceObjectClassClassOps,
63
    JS_NULL_CLASS_SPEC,
64
    JS_NULL_CLASS_EXT,
65
    &sInterfaceObjectClassObjectOps
66
  },
67
  eInterface,
68
  true,
69
  prototypes::id::SVGFEFuncRElement,
70
  PrototypeTraits<prototypes::id::SVGFEFuncRElement>::Depth,
71
  sNativePropertyHooks,
72
  "function SVGFEFuncRElement() {\n    [native code]\n}",
73
  SVGComponentTransferFunctionElement_Binding::GetConstructorObject
74
};
75
76
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
77
  {
78
    "SVGFEFuncRElementPrototype",
79
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
80
    JS_NULL_CLASS_OPS,
81
    JS_NULL_CLASS_SPEC,
82
    JS_NULL_CLASS_EXT,
83
    JS_NULL_OBJECT_OPS
84
  },
85
  eInterfacePrototype,
86
  false,
87
  prototypes::id::SVGFEFuncRElement,
88
  PrototypeTraits<prototypes::id::SVGFEFuncRElement>::Depth,
89
  sNativePropertyHooks,
90
  "[object SVGFEFuncRElementPrototype]",
91
  SVGComponentTransferFunctionElement_Binding::GetProtoObject
92
};
93
94
static const js::ClassOps sClassOps = {
95
  _addProperty, /* addProperty */
96
  nullptr,               /* delProperty */
97
  nullptr,               /* enumerate */
98
  nullptr, /* newEnumerate */
99
  nullptr, /* resolve */
100
  nullptr, /* mayResolve */
101
  _finalize, /* finalize */
102
  nullptr, /* call */
103
  nullptr,               /* hasInstance */
104
  nullptr,               /* construct */
105
  nullptr, /* trace */
106
};
107
108
static const js::ClassExtension sClassExtension = {
109
  nullptr, /* weakmapKeyDelegateOp */
110
  _objectMoved /* objectMovedOp */
111
};
112
113
static const DOMJSClass sClass = {
114
  { "SVGFEFuncRElement",
115
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
116
    &sClassOps,
117
    JS_NULL_CLASS_SPEC,
118
    &sClassExtension,
119
    JS_NULL_OBJECT_OPS
120
  },
121
  { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGComponentTransferFunctionElement, prototypes::id::SVGFEFuncRElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
122
  IsBaseOf<nsISupports, mozilla::dom::SVGFEFuncRElement >::value,
123
  sNativePropertyHooks,
124
  FindAssociatedGlobalForNative<mozilla::dom::SVGFEFuncRElement>::Get,
125
  GetProtoObjectHandle,
126
  GetCCParticipant<mozilla::dom::SVGFEFuncRElement>::Get()
127
};
128
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
129
              "Must have the right minimal number of reserved slots.");
130
static_assert(1 >= 1,
131
              "Must have enough reserved slots.");
132
133
const JSClass*
134
GetJSClass()
135
0
{
136
0
  return sClass.ToJSClass();
137
0
}
138
139
bool
140
Wrap(JSContext* aCx, mozilla::dom::SVGFEFuncRElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
141
0
{
142
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::SVGFEFuncRElement>::value,
143
0
                "Shouldn't have wrappercached things that are not refcounted.");
144
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGFEFuncRElement*>(aObject) ==
145
0
             reinterpret_cast<mozilla::dom::SVGFEFuncRElement*>(aObject),
146
0
             "Multiple inheritance for mozilla::dom::SVGFEFuncRElement is broken.");
147
0
  MOZ_ASSERT(static_cast<mozilla::dom::SVGComponentTransferFunctionElement*>(aObject) ==
148
0
             reinterpret_cast<mozilla::dom::SVGComponentTransferFunctionElement*>(aObject),
149
0
             "Multiple inheritance for mozilla::dom::SVGComponentTransferFunctionElement is broken.");
150
0
  MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
151
0
             reinterpret_cast<nsSVGElement*>(aObject),
152
0
             "Multiple inheritance for nsSVGElement is broken.");
153
0
  MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
154
0
             reinterpret_cast<mozilla::dom::Element*>(aObject),
155
0
             "Multiple inheritance for mozilla::dom::Element is broken.");
156
0
  MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
157
0
             reinterpret_cast<nsINode*>(aObject),
158
0
             "Multiple inheritance for nsINode is broken.");
159
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
160
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
161
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
162
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
163
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
164
0
  MOZ_ASSERT(!aCache->GetWrapper(),
165
0
             "You should probably not be using Wrap() directly; use "
166
0
             "GetOrCreateDOMReflector instead");
167
0
168
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
169
0
             "nsISupports must be on our primary inheritance chain");
170
0
171
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
172
0
  if (!global) {
173
0
    return false;
174
0
  }
175
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
176
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
177
0
178
0
  // That might have ended up wrapping us already, due to the wonders
179
0
  // of XBL.  Check for that, and bail out as needed.
180
0
  aReflector.set(aCache->GetWrapper());
181
0
  if (aReflector) {
182
#ifdef DEBUG
183
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
184
#endif // DEBUG
185
    return true;
186
0
  }
187
0
188
0
  JSAutoRealm ar(aCx, global);
189
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
190
0
  if (!canonicalProto) {
191
0
    return false;
192
0
  }
193
0
  JS::Rooted<JSObject*> proto(aCx);
194
0
  if (aGivenProto) {
195
0
    proto = aGivenProto;
196
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
197
0
    // coming in, we changed compartments to that of "parent" so may need
198
0
    // to wrap the proto here.
199
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
200
0
      if (!JS_WrapObject(aCx, &proto)) {
201
0
        return false;
202
0
      }
203
0
    }
204
0
  } else {
205
0
    proto = canonicalProto;
206
0
  }
207
0
208
0
  BindingJSObjectCreator<mozilla::dom::SVGFEFuncRElement> creator(aCx);
209
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
210
0
  if (!aReflector) {
211
0
    return false;
212
0
  }
213
0
214
0
  aCache->SetWrapper(aReflector);
215
0
  creator.InitializationSucceeded();
216
0
217
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
218
0
             aCache->GetWrapperPreserveColor() == aReflector);
219
0
  // If proto != canonicalProto, we have to preserve our wrapper;
220
0
  // otherwise we won't be able to properly recreate it later, since
221
0
  // we won't know what proto to use.  Note that we don't check
222
0
  // aGivenProto here, since it's entirely possible (and even
223
0
  // somewhat common) to have a non-null aGivenProto which is the
224
0
  // same as canonicalProto.
225
0
  if (proto != canonicalProto) {
226
0
    PreserveWrapper(aObject);
227
0
  }
228
0
229
0
  return true;
230
0
}
231
232
const NativePropertyHooks sNativePropertyHooks[] = { {
233
  nullptr,
234
  nullptr,
235
  nullptr,
236
  { nullptr, nullptr },
237
  prototypes::id::SVGFEFuncRElement,
238
  constructors::id::SVGFEFuncRElement,
239
  SVGComponentTransferFunctionElement_Binding::sNativePropertyHooks,
240
  &DefaultXrayExpandoObjectClass
241
} };
242
243
void
244
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
245
0
{
246
0
  JS::Handle<JSObject*> parentProto(SVGComponentTransferFunctionElement_Binding::GetProtoObjectHandle(aCx));
247
0
  if (!parentProto) {
248
0
    return;
249
0
  }
250
0
251
0
  JS::Handle<JSObject*> constructorProto(SVGComponentTransferFunctionElement_Binding::GetConstructorObjectHandle(aCx));
252
0
  if (!constructorProto) {
253
0
    return;
254
0
  }
255
0
256
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEFuncRElement);
257
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEFuncRElement);
258
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
259
0
                              &sPrototypeClass.mBase, protoCache,
260
0
                              nullptr,
261
0
                              constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
262
0
                              interfaceCache,
263
0
                              nullptr,
264
0
                              nullptr,
265
0
                              "SVGFEFuncRElement", aDefineOnGlobal,
266
0
                              nullptr,
267
0
                              false);
268
0
}
269
270
JSObject*
271
GetConstructorObject(JSContext* aCx)
272
0
{
273
0
  return GetConstructorObjectHandle(aCx);
274
0
}
275
276
} // namespace SVGFEFuncRElement_Binding
277
278
279
280
} // namespace dom
281
} // namespace mozilla