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"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsIScriptGlobalObject.h"
17 #include "nsIWeakReferenceUtils.h"
29 class DOMImplementation final
: public nsISupports
, public nsWrapperCache
{
33 DOMImplementation(Document
* aOwner
, nsIGlobalObject
* aScriptObject
,
34 nsIURI
* aDocumentURI
, nsIURI
* aBaseURI
);
36 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
37 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(DOMImplementation
)
39 Document
* GetParentObject() const { return mOwner
; }
41 virtual JSObject
* WrapObject(JSContext
* aCx
,
42 JS::Handle
<JSObject
*> aGivenProto
) override
;
44 bool HasFeature() { return true; }
46 already_AddRefed
<DocumentType
> CreateDocumentType(
47 const nsAString
& aQualifiedName
, const nsAString
& aPublicId
,
48 const nsAString
& aSystemId
, ErrorResult
& aRv
);
50 already_AddRefed
<Document
> CreateDocument(const nsAString
& aNamespaceURI
,
51 const nsAString
& aQualifiedName
,
52 DocumentType
* aDoctype
,
55 already_AddRefed
<Document
> CreateHTMLDocument(
56 const Optional
<nsAString
>& aTitle
, ErrorResult
& aRv
);
59 nsresult
CreateDocument(const nsAString
& aNamespaceURI
,
60 const nsAString
& aQualifiedName
,
61 DocumentType
* aDoctype
, Document
** aDocument
);
62 nsresult
CreateHTMLDocument(const nsAString
& aTitle
, Document
** aDocument
);
64 nsCOMPtr
<Document
> mOwner
;
65 nsWeakPtr mScriptObject
;
66 nsCOMPtr
<nsIURI
> mDocumentURI
;
67 nsCOMPtr
<nsIURI
> mBaseURI
;
71 } // namespace mozilla
73 #endif // mozilla_dom_DOMImplementation_h