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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_DOMImplementation_h
8 #define mozilla_dom_DOMImplementation_h
10 #include "nsWrapperCache.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/ErrorResult.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "mozilla/dom/Document.h"
17 #include "nsIScriptGlobalObject.h"
19 #include "nsIWeakReferenceUtils.h"
27 class DOMImplementation final
: public nsISupports
, public nsWrapperCache
{
28 ~DOMImplementation() {}
31 DOMImplementation(Document
* aOwner
, nsIGlobalObject
* aScriptObject
,
32 nsIURI
* aDocumentURI
, nsIURI
* aBaseURI
)
34 mScriptObject(do_GetWeakReference(aScriptObject
)),
35 mDocumentURI(aDocumentURI
),
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation
)
43 Document
* GetParentObject() const { return mOwner
; }
45 virtual JSObject
* WrapObject(JSContext
* aCx
,
46 JS::Handle
<JSObject
*> aGivenProto
) override
;
48 bool HasFeature() { return true; }
50 already_AddRefed
<DocumentType
> CreateDocumentType(
51 const nsAString
& aQualifiedName
, const nsAString
& aPublicId
,
52 const nsAString
& aSystemId
, ErrorResult
& aRv
);
54 already_AddRefed
<Document
> CreateDocument(const nsAString
& aNamespaceURI
,
55 const nsAString
& aQualifiedName
,
56 DocumentType
* aDoctype
,
59 already_AddRefed
<Document
> CreateHTMLDocument(
60 const Optional
<nsAString
>& aTitle
, ErrorResult
& aRv
);
63 nsresult
CreateDocument(const nsAString
& aNamespaceURI
,
64 const nsAString
& aQualifiedName
,
65 DocumentType
* aDoctype
, Document
** aDocument
);
66 nsresult
CreateHTMLDocument(const nsAString
& aTitle
, Document
** aDocument
);
68 nsCOMPtr
<Document
> mOwner
;
69 nsWeakPtr mScriptObject
;
70 nsCOMPtr
<nsIURI
> mDocumentURI
;
71 nsCOMPtr
<nsIURI
> mBaseURI
;
75 } // namespace mozilla
77 #endif // mozilla_dom_DOMImplementation_h