summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in')
-rw-r--r--toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in55
1 files changed, 55 insertions, 0 deletions
diff --git a/toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in b/toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in
new file mode 100644
index 0000000000..c97fc87c78
--- /dev/null
+++ b/toolkit/components/extensions/webidl-api/ExtensionAPI.cpp.in
@@ -0,0 +1,55 @@
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "{{ webidl_name }}.h"
+#include "ExtensionEventManager.h"
+
+#include "mozilla/dom/{{ webidl_name }}Binding.h"
+#include "nsIGlobalObject.h"
+
+namespace mozilla {
+namespace extensions {
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF({{ webidl_name }});
+NS_IMPL_CYCLE_COLLECTING_RELEASE({{ webidl_name }})
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE({{ webidl_name }}, mGlobal, mExtensionBrowser
+ /* TODO: add events properties if any */);
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION({{ webidl_name }})
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+{{ webidl_name }}::{{ webidl_name }}(nsIGlobalObject* aGlobal,
+ ExtensionBrowser* aExtensionBrowser)
+ : mGlobal(aGlobal), mExtensionBrowser(aExtensionBrowser) {
+ MOZ_DIAGNOSTIC_ASSERT(mGlobal);
+ MOZ_DIAGNOSTIC_ASSERT(mExtensionBrowser);
+}
+
+/* static */
+bool {{ webidl_name }}::IsAllowed(JSContext* aCx, JSObject* aGlobal) {
+ return true;
+}
+
+JSObject* {{ webidl_name }}::WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) {
+ return dom::{{ webidl_name }}_Binding::Wrap(aCx, this, aGivenProto);
+}
+
+nsIGlobalObject* {{ webidl_name }}::GetParentObject() const { return mGlobal; }
+
+/* TODO add implementation for the event manager getter if any.
+ExtensionEventManager* {{ webidl_name}}::OnEVENTNAME() {
+ if (!mOnEVENTNAMEEventMgr) {
+ mOnEVENTNAMEEventMgr = CreateEventManager(u"onEventName"_ns);
+ }
+
+ return mOnEVENTNAMEEventMgr;
+}
+*/
+
+} // namespace extensions
+} // namespace mozilla