Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #include "mozilla/dom/TestInterfaceSetlikeNode.h"
6 : #include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h"
7 : #include "nsPIDOMWindow.h"
8 : #include "mozilla/dom/BindingUtils.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceSetlikeNode, mParent)
14 :
15 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceSetlikeNode)
16 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceSetlikeNode)
17 :
18 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceSetlikeNode)
19 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
20 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
21 0 : NS_INTERFACE_MAP_END
22 :
23 0 : TestInterfaceSetlikeNode::TestInterfaceSetlikeNode(JSContext* aCx,
24 0 : nsPIDOMWindowInner* aParent)
25 0 : : mParent(aParent)
26 : {
27 0 : }
28 :
29 : //static
30 : already_AddRefed<TestInterfaceSetlikeNode>
31 0 : TestInterfaceSetlikeNode::Constructor(const GlobalObject& aGlobal,
32 : ErrorResult& aRv)
33 : {
34 0 : nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
35 0 : if (!window) {
36 0 : aRv.Throw(NS_ERROR_FAILURE);
37 0 : return nullptr;
38 : }
39 :
40 0 : RefPtr<TestInterfaceSetlikeNode> r = new TestInterfaceSetlikeNode(nullptr, window);
41 0 : return r.forget();
42 : }
43 :
44 : JSObject*
45 0 : TestInterfaceSetlikeNode::WrapObject(JSContext* aCx,
46 : JS::Handle<JSObject*> aGivenProto)
47 : {
48 0 : return TestInterfaceSetlikeNodeBinding::Wrap(aCx, this, aGivenProto);
49 : }
50 :
51 : nsPIDOMWindowInner*
52 0 : TestInterfaceSetlikeNode::GetParentObject() const
53 : {
54 0 : return mParent;
55 : }
56 :
57 : } // namespace dom
58 : } // namespace mozilla
|