/work/obj-fuzz/dist/include/mozilla/dom/XMLDocument.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_XMLDocument_h |
8 | | #define mozilla_dom_XMLDocument_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "mozilla/dom/BindingDeclarations.h" |
12 | | #include "nsDocument.h" |
13 | | #include "nsIScriptContext.h" |
14 | | |
15 | | class nsIURI; |
16 | | class nsIChannel; |
17 | | |
18 | | namespace mozilla { |
19 | | namespace dom { |
20 | | |
21 | | class XMLDocument : public nsDocument |
22 | | { |
23 | | public: |
24 | | explicit XMLDocument(const char* aContentType = "application/xml"); |
25 | | |
26 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, nsDocument) |
27 | | |
28 | | virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override; |
29 | | virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, |
30 | | nsIPrincipal* aPrincipal) override; |
31 | | |
32 | | virtual void SetSuppressParserErrorElement(bool aSuppress) override; |
33 | | virtual bool SuppressParserErrorElement() override; |
34 | | |
35 | | virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) override; |
36 | | virtual bool SuppressParserErrorConsoleMessages() override; |
37 | | |
38 | | virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel, |
39 | | nsILoadGroup* aLoadGroup, |
40 | | nsISupports* aContainer, |
41 | | nsIStreamListener **aDocListener, |
42 | | bool aReset = true, |
43 | | nsIContentSink* aSink = nullptr) override; |
44 | | |
45 | | virtual void EndLoad() override; |
46 | | |
47 | | virtual nsresult Init() override; |
48 | | |
49 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
50 | | |
51 | | virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override; |
52 | | // DocAddSizeOfIncludingThis is inherited from nsIDocument. |
53 | | |
54 | | |
55 | | // WebIDL API |
56 | | bool Load(const nsAString& aUrl, CallerType aCallerType, ErrorResult& aRv); |
57 | | bool Async() const |
58 | 0 | { |
59 | 0 | return mAsync; |
60 | 0 | } |
61 | | void SetAsync(bool aAsync) |
62 | 0 | { |
63 | 0 | mAsync = aAsync; |
64 | 0 | } |
65 | | |
66 | | // .location is [Unforgeable], so we have to make it clear that the |
67 | | // nsIDocument version applies to us (it's shadowed by the XPCOM thing on |
68 | | // nsDocument). |
69 | | using nsIDocument::GetLocation; |
70 | | |
71 | | protected: |
72 | | virtual ~XMLDocument(); |
73 | | |
74 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
75 | | |
76 | | friend nsresult (::NS_NewXMLDocument)(nsIDocument**, bool, bool); |
77 | | |
78 | | |
79 | | // mChannelIsPending indicates whether we're currently asynchronously loading |
80 | | // data from mChannel (via document.load() or normal load). It's set to true |
81 | | // when we first find out about the channel (StartDocumentLoad) and set to |
82 | | // false in EndLoad or if ResetToURI() is called. In the latter case our |
83 | | // mChannel is also cancelled. Note that if this member is true, mChannel |
84 | | // cannot be null. |
85 | | bool mChannelIsPending; |
86 | | bool mAsync; |
87 | | bool mLoopingForSyncLoad; |
88 | | |
89 | | // If true. we're really a Document, not an XMLDocument |
90 | | bool mIsPlainDocument; |
91 | | |
92 | | // If true, do not output <parsererror> elements. Per spec, XMLHttpRequest |
93 | | // shouldn't output them, whereas DOMParser/others should (see bug 918703). |
94 | | bool mSuppressParserErrorElement; |
95 | | |
96 | | // If true, do not log parsing errors to the web console (see bug 884693). |
97 | | bool mSuppressParserErrorConsoleMessages; |
98 | | }; |
99 | | |
100 | | } // namespace dom |
101 | | } // namespace mozilla |
102 | | |
103 | | #endif // mozilla_dom_XMLDocument_h |