/work/obj-fuzz/dist/include/mozilla/dom/ExternalBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM External.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_ExternalBinding_h |
4 | | #define mozilla_dom_ExternalBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/ErrorResult.h" |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/CallbackInterface.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | #include "mozilla/dom/ToJSValue.h" |
15 | | #include "nsWeakReference.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | class External; |
21 | | struct ExternalAtoms; |
22 | | struct NativePropertyHooks; |
23 | | class ProtoAndIfaceCache; |
24 | | |
25 | | } // namespace dom |
26 | | } // namespace mozilla |
27 | | |
28 | | namespace mozilla { |
29 | | namespace dom { |
30 | | |
31 | | namespace External_Binding { |
32 | | |
33 | | typedef mozilla::dom::External NativeType; |
34 | | |
35 | | const JSClass* |
36 | | GetJSClass(); |
37 | | |
38 | | bool |
39 | | Wrap(JSContext* aCx, mozilla::dom::External* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
40 | | |
41 | | template <class T> |
42 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
43 | 0 | { |
44 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
45 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
46 | 0 | } |
47 | | |
48 | | // We declare this as an array so that retrieving a pointer to this |
49 | | // binding's property hooks only requires compile/link-time resolvable |
50 | | // address arithmetic. Declaring it as a pointer instead would require |
51 | | // doing a run-time load to fetch a pointer to this binding's property |
52 | | // hooks. And then structures which embedded a pointer to this structure |
53 | | // would require a run-time load for proper initialization, which would |
54 | | // then induce static constructors. Lots of static constructors. |
55 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
56 | | |
57 | | void |
58 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
59 | | |
60 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
61 | 0 | { |
62 | 0 | /* Get the interface prototype object for this class. This will create the |
63 | 0 | object as needed. */ |
64 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::External, |
65 | 0 | &CreateInterfaceObjects, |
66 | 0 | /* aDefineOnGlobal = */ true); |
67 | 0 |
|
68 | 0 | } |
69 | | |
70 | | } // namespace External_Binding |
71 | | |
72 | | |
73 | | |
74 | | class ExternalJSImpl : public CallbackInterface |
75 | | { |
76 | | public: |
77 | | explicit inline ExternalJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
78 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
79 | 0 | { |
80 | 0 | } |
81 | | |
82 | | explicit inline ExternalJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
83 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
84 | 0 | { |
85 | 0 | } |
86 | | |
87 | | explicit inline ExternalJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
88 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
89 | 0 | { |
90 | 0 | } |
91 | | |
92 | | void AddSearchProvider(const nsAString& aDescriptionURL, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
93 | | |
94 | | uint32_t IsSearchProviderInstalled(const nsAString& aSearchURL, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
95 | | |
96 | | inline bool |
97 | | operator==(const ExternalJSImpl& aOther) const |
98 | 0 | { |
99 | 0 | return CallbackInterface::operator==(aOther); |
100 | 0 | } |
101 | | |
102 | | private: |
103 | | static bool |
104 | | InitIds(JSContext* cx, ExternalAtoms* atomsCache); |
105 | | }; |
106 | | |
107 | | |
108 | | class External final : public nsSupportsWeakReference, |
109 | | public nsWrapperCache |
110 | | { |
111 | | public: |
112 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
113 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(External) |
114 | | |
115 | | private: |
116 | | RefPtr<ExternalJSImpl> mImpl; |
117 | | nsCOMPtr<nsIGlobalObject> mParent; |
118 | | |
119 | | public: |
120 | | External(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent); |
121 | | |
122 | | private: |
123 | | ~External(); |
124 | | |
125 | | public: |
126 | | nsISupports* GetParentObject() const; |
127 | | |
128 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
129 | | |
130 | | void AddSearchProvider(const nsAString& aDescriptionURL, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
131 | | |
132 | | uint32_t IsSearchProviderInstalled(const nsAString& aSearchURL, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
133 | | |
134 | | static bool |
135 | | _Create(JSContext* cx, unsigned argc, JS::Value* vp); |
136 | | }; |
137 | | |
138 | | |
139 | | } // namespace dom |
140 | | } // namespace mozilla |
141 | | |
142 | | #endif // mozilla_dom_ExternalBinding_h |