content/base/src/DOMImplementation.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"
    13 #include "nsCOMPtr.h"
    14 #include "nsCycleCollectionParticipant.h"
    15 #include "nsIDocument.h"
    16 #include "nsIScriptGlobalObject.h"
    17 #include "nsIURI.h"
    18 #include "nsIWeakReferenceUtils.h"
    19 #include "nsString.h"
    21 class nsIDOMDocument;
    23 namespace mozilla {
    24 namespace dom {
    25 class DocumentType;
    27 class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation
    28                                   , public nsWrapperCache
    29 {
    30 public:
    31   DOMImplementation(nsIDocument* aOwner,
    32                     nsIGlobalObject* aScriptObject,
    33                     nsIURI* aDocumentURI,
    34                     nsIURI* aBaseURI)
    35     : mOwner(aOwner)
    36     , mScriptObject(do_GetWeakReference(aScriptObject))
    37     , mDocumentURI(aDocumentURI)
    38     , mBaseURI(aBaseURI)
    39   {
    40     MOZ_ASSERT(aOwner);
    41     SetIsDOMBinding();
    42   }
    44   ~DOMImplementation()
    45   {
    46   }
    48   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    49   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)
    51   nsIDocument* GetParentObject() const
    52   {
    53     return mOwner;
    54   }
    56   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    58   // nsIDOMDOMImplementation
    59   NS_DECL_NSIDOMDOMIMPLEMENTATION
    61   bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
    63   already_AddRefed<DocumentType>
    64   CreateDocumentType(const nsAString& aQualifiedName,
    65                      const nsAString& aPublicId,
    66                      const nsAString& aSystemId,
    67                      ErrorResult& aRv);
    69   already_AddRefed<nsIDocument>
    70   CreateDocument(const nsAString& aNamespaceURI,
    71                  const nsAString& aQualifiedName,
    72                  nsIDOMDocumentType* aDoctype,
    73                  ErrorResult& aRv);
    75   already_AddRefed<nsIDocument>
    76   CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv);
    78 private:
    79   nsresult CreateDocument(const nsAString& aNamespaceURI,
    80                           const nsAString& aQualifiedName,
    81                           nsIDOMDocumentType* aDoctype,
    82                           nsIDocument** aDocument,
    83                           nsIDOMDocument** aDOMDocument);
    84   nsresult CreateHTMLDocument(const nsAString& aTitle,
    85                               nsIDocument** aDocument,
    86                               nsIDOMDocument** aDOMDocument);
    88   nsCOMPtr<nsIDocument> mOwner;
    89   nsWeakPtr mScriptObject;
    90   nsCOMPtr<nsIURI> mDocumentURI;
    91   nsCOMPtr<nsIURI> mBaseURI;
    92 };
    94 } // namespace dom
    95 } // namespace mozilla
    97 #endif // mozilla_dom_DOMImplementation_h

mercurial