Bug 1941046 - Part 4: Send a callback request for impression and clicks of MARS Top...
[gecko.git] / dom / bindings / test / TestInterfaceSetlike.cpp
blobac973d1c235ac334f9d950ce0cd61404e076db42
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/TestInterfaceSetlike.h"
8 #include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h"
9 #include "nsPIDOMWindow.h"
10 #include "mozilla/dom/BindingUtils.h"
12 namespace mozilla::dom {
14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceSetlike, mParent)
16 NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceSetlike)
17 NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceSetlike)
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceSetlike)
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21 NS_INTERFACE_MAP_ENTRY(nsISupports)
22 NS_INTERFACE_MAP_END
24 TestInterfaceSetlike::TestInterfaceSetlike(JSContext* aCx,
25 nsPIDOMWindowInner* aParent)
26 : mParent(aParent) {}
28 // static
29 already_AddRefed<TestInterfaceSetlike> TestInterfaceSetlike::Constructor(
30 const GlobalObject& aGlobal, ErrorResult& aRv) {
31 nsCOMPtr<nsPIDOMWindowInner> window =
32 do_QueryInterface(aGlobal.GetAsSupports());
33 if (!window) {
34 aRv.Throw(NS_ERROR_FAILURE);
35 return nullptr;
38 RefPtr<TestInterfaceSetlike> r = new TestInterfaceSetlike(nullptr, window);
39 return r.forget();
42 JSObject* TestInterfaceSetlike::WrapObject(JSContext* aCx,
43 JS::Handle<JSObject*> aGivenProto) {
44 return TestInterfaceSetlike_Binding::Wrap(aCx, this, aGivenProto);
47 nsPIDOMWindowInner* TestInterfaceSetlike::GetParentObject() const {
48 return mParent;
51 } // namespace mozilla::dom