Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / bindings / test / TestInterfaceSetlikeNode.cpp
blob5d01c50b428200a7b6e93defc28a682b5d3a8ff4
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/TestInterfaceSetlikeNode.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(TestInterfaceSetlikeNode, mParent)
16 NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceSetlikeNode)
17 NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceSetlikeNode)
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceSetlikeNode)
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21 NS_INTERFACE_MAP_ENTRY(nsISupports)
22 NS_INTERFACE_MAP_END
24 TestInterfaceSetlikeNode::TestInterfaceSetlikeNode(JSContext* aCx,
25 nsPIDOMWindowInner* aParent)
26 : mParent(aParent) {}
28 // static
29 already_AddRefed<TestInterfaceSetlikeNode>
30 TestInterfaceSetlikeNode::Constructor(const GlobalObject& aGlobal,
31 ErrorResult& aRv) {
32 nsCOMPtr<nsPIDOMWindowInner> window =
33 do_QueryInterface(aGlobal.GetAsSupports());
34 if (!window) {
35 aRv.Throw(NS_ERROR_FAILURE);
36 return nullptr;
39 RefPtr<TestInterfaceSetlikeNode> r =
40 new TestInterfaceSetlikeNode(nullptr, window);
41 return r.forget();
44 JSObject* TestInterfaceSetlikeNode::WrapObject(
45 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
46 return TestInterfaceSetlikeNode_Binding::Wrap(aCx, this, aGivenProto);
49 nsPIDOMWindowInner* TestInterfaceSetlikeNode::GetParentObject() const {
50 return mParent;
53 } // namespace mozilla::dom