Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_dom_DOMImplementation_h |
michael@0 | 6 | #define mozilla_dom_DOMImplementation_h |
michael@0 | 7 | |
michael@0 | 8 | #include "nsIDOMDOMImplementation.h" |
michael@0 | 9 | #include "nsWrapperCache.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "mozilla/Attributes.h" |
michael@0 | 12 | #include "mozilla/ErrorResult.h" |
michael@0 | 13 | #include "nsCOMPtr.h" |
michael@0 | 14 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 15 | #include "nsIDocument.h" |
michael@0 | 16 | #include "nsIScriptGlobalObject.h" |
michael@0 | 17 | #include "nsIURI.h" |
michael@0 | 18 | #include "nsIWeakReferenceUtils.h" |
michael@0 | 19 | #include "nsString.h" |
michael@0 | 20 | |
michael@0 | 21 | class nsIDOMDocument; |
michael@0 | 22 | |
michael@0 | 23 | namespace mozilla { |
michael@0 | 24 | namespace dom { |
michael@0 | 25 | class DocumentType; |
michael@0 | 26 | |
michael@0 | 27 | class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation |
michael@0 | 28 | , public nsWrapperCache |
michael@0 | 29 | { |
michael@0 | 30 | public: |
michael@0 | 31 | DOMImplementation(nsIDocument* aOwner, |
michael@0 | 32 | nsIGlobalObject* aScriptObject, |
michael@0 | 33 | nsIURI* aDocumentURI, |
michael@0 | 34 | nsIURI* aBaseURI) |
michael@0 | 35 | : mOwner(aOwner) |
michael@0 | 36 | , mScriptObject(do_GetWeakReference(aScriptObject)) |
michael@0 | 37 | , mDocumentURI(aDocumentURI) |
michael@0 | 38 | , mBaseURI(aBaseURI) |
michael@0 | 39 | { |
michael@0 | 40 | MOZ_ASSERT(aOwner); |
michael@0 | 41 | SetIsDOMBinding(); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | ~DOMImplementation() |
michael@0 | 45 | { |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 49 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation) |
michael@0 | 50 | |
michael@0 | 51 | nsIDocument* GetParentObject() const |
michael@0 | 52 | { |
michael@0 | 53 | return mOwner; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
michael@0 | 57 | |
michael@0 | 58 | // nsIDOMDOMImplementation |
michael@0 | 59 | NS_DECL_NSIDOMDOMIMPLEMENTATION |
michael@0 | 60 | |
michael@0 | 61 | bool HasFeature(const nsAString& aFeature, const nsAString& aVersion); |
michael@0 | 62 | |
michael@0 | 63 | already_AddRefed<DocumentType> |
michael@0 | 64 | CreateDocumentType(const nsAString& aQualifiedName, |
michael@0 | 65 | const nsAString& aPublicId, |
michael@0 | 66 | const nsAString& aSystemId, |
michael@0 | 67 | ErrorResult& aRv); |
michael@0 | 68 | |
michael@0 | 69 | already_AddRefed<nsIDocument> |
michael@0 | 70 | CreateDocument(const nsAString& aNamespaceURI, |
michael@0 | 71 | const nsAString& aQualifiedName, |
michael@0 | 72 | nsIDOMDocumentType* aDoctype, |
michael@0 | 73 | ErrorResult& aRv); |
michael@0 | 74 | |
michael@0 | 75 | already_AddRefed<nsIDocument> |
michael@0 | 76 | CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv); |
michael@0 | 77 | |
michael@0 | 78 | private: |
michael@0 | 79 | nsresult CreateDocument(const nsAString& aNamespaceURI, |
michael@0 | 80 | const nsAString& aQualifiedName, |
michael@0 | 81 | nsIDOMDocumentType* aDoctype, |
michael@0 | 82 | nsIDocument** aDocument, |
michael@0 | 83 | nsIDOMDocument** aDOMDocument); |
michael@0 | 84 | nsresult CreateHTMLDocument(const nsAString& aTitle, |
michael@0 | 85 | nsIDocument** aDocument, |
michael@0 | 86 | nsIDOMDocument** aDOMDocument); |
michael@0 | 87 | |
michael@0 | 88 | nsCOMPtr<nsIDocument> mOwner; |
michael@0 | 89 | nsWeakPtr mScriptObject; |
michael@0 | 90 | nsCOMPtr<nsIURI> mDocumentURI; |
michael@0 | 91 | nsCOMPtr<nsIURI> mBaseURI; |
michael@0 | 92 | }; |
michael@0 | 93 | |
michael@0 | 94 | } // namespace dom |
michael@0 | 95 | } // namespace mozilla |
michael@0 | 96 | |
michael@0 | 97 | #endif // mozilla_dom_DOMImplementation_h |