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