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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_DOMImplementation_h
6 #define mozilla_dom_DOMImplementation_h
8 #include "nsIDOMDOMImplementation.h"
9 #include "nsWrapperCache.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/ErrorResult.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsIDocument.h"
16 #include "nsIScriptGlobalObject.h"
18 #include "nsIWeakReferenceUtils.h"
27 class DOMImplementation MOZ_FINAL
: public nsIDOMDOMImplementation
28 , public nsWrapperCache
35 DOMImplementation(nsIDocument
* aOwner
,
36 nsIGlobalObject
* aScriptObject
,
40 , mScriptObject(do_GetWeakReference(aScriptObject
))
41 , mDocumentURI(aDocumentURI
)
47 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
48 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation
)
50 nsIDocument
* GetParentObject() const
55 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
57 // nsIDOMDOMImplementation
58 NS_DECL_NSIDOMDOMIMPLEMENTATION
60 bool HasFeature(const nsAString
& aFeature
, const nsAString
& aVersion
);
62 already_AddRefed
<DocumentType
>
63 CreateDocumentType(const nsAString
& aQualifiedName
,
64 const nsAString
& aPublicId
,
65 const nsAString
& aSystemId
,
68 already_AddRefed
<nsIDocument
>
69 CreateDocument(const nsAString
& aNamespaceURI
,
70 const nsAString
& aQualifiedName
,
71 nsIDOMDocumentType
* aDoctype
,
74 already_AddRefed
<nsIDocument
>
75 CreateHTMLDocument(const Optional
<nsAString
>& aTitle
, ErrorResult
& aRv
);
78 nsresult
CreateDocument(const nsAString
& aNamespaceURI
,
79 const nsAString
& aQualifiedName
,
80 nsIDOMDocumentType
* aDoctype
,
81 nsIDocument
** aDocument
,
82 nsIDOMDocument
** aDOMDocument
);
83 nsresult
CreateHTMLDocument(const nsAString
& aTitle
,
84 nsIDocument
** aDocument
,
85 nsIDOMDocument
** aDOMDocument
);
87 nsCOMPtr
<nsIDocument
> mOwner
;
88 nsWeakPtr mScriptObject
;
89 nsCOMPtr
<nsIURI
> mDocumentURI
;
90 nsCOMPtr
<nsIURI
> mBaseURI
;
94 } // namespace mozilla
96 #endif // mozilla_dom_DOMImplementation_h