Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/DOMImplementation.h
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#ifndef mozilla_dom_DOMImplementation_h
8
#define mozilla_dom_DOMImplementation_h
9
10
#include "nsWrapperCache.h"
11
12
#include "mozilla/Attributes.h"
13
#include "mozilla/ErrorResult.h"
14
#include "nsCOMPtr.h"
15
#include "nsCycleCollectionParticipant.h"
16
#include "nsIDocument.h"
17
#include "nsIScriptGlobalObject.h"
18
#include "nsIURI.h"
19
#include "nsIWeakReferenceUtils.h"
20
#include "nsString.h"
21
22
namespace mozilla {
23
namespace dom {
24
class DocumentType;
25
26
class DOMImplementation final : public nsISupports
27
                              , public nsWrapperCache
28
{
29
  ~DOMImplementation()
30
0
  {
31
0
  }
32
33
public:
34
  DOMImplementation(nsIDocument* aOwner,
35
                    nsIGlobalObject* aScriptObject,
36
                    nsIURI* aDocumentURI,
37
                    nsIURI* aBaseURI)
38
    : mOwner(aOwner)
39
    , mScriptObject(do_GetWeakReference(aScriptObject))
40
    , mDocumentURI(aDocumentURI)
41
    , mBaseURI(aBaseURI)
42
0
  {
43
0
    MOZ_ASSERT(aOwner);
44
0
  }
45
46
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
47
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)
48
49
  nsIDocument* GetParentObject() const
50
0
  {
51
0
    return mOwner;
52
0
  }
53
54
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
55
56
  bool HasFeature()
57
0
  {
58
0
    return true;
59
0
  }
60
61
  already_AddRefed<DocumentType>
62
  CreateDocumentType(const nsAString& aQualifiedName,
63
                     const nsAString& aPublicId,
64
                     const nsAString& aSystemId,
65
                     ErrorResult& aRv);
66
67
  already_AddRefed<nsIDocument>
68
  CreateDocument(const nsAString& aNamespaceURI,
69
                 const nsAString& aQualifiedName,
70
                 DocumentType* aDoctype,
71
                 ErrorResult& aRv);
72
73
  already_AddRefed<nsIDocument>
74
  CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv);
75
76
private:
77
  nsresult CreateDocument(const nsAString& aNamespaceURI,
78
                          const nsAString& aQualifiedName,
79
                          DocumentType* aDoctype,
80
                          nsIDocument** aDocument);
81
  nsresult CreateHTMLDocument(const nsAString& aTitle,
82
                              nsIDocument** aDocument);
83
84
  nsCOMPtr<nsIDocument> mOwner;
85
  nsWeakPtr mScriptObject;
86
  nsCOMPtr<nsIURI> mDocumentURI;
87
  nsCOMPtr<nsIURI> mBaseURI;
88
};
89
90
} // namespace dom
91
} // namespace mozilla
92
93
#endif // mozilla_dom_DOMImplementation_h