content/xml/document/src/XMLDocument.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c1a079b64b7a
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef mozilla_dom_XMLDocument_h
7 #define mozilla_dom_XMLDocument_h
8
9 #include "mozilla/Attributes.h"
10 #include "nsDocument.h"
11 #include "nsIDOMXMLDocument.h"
12 #include "nsIScriptContext.h"
13
14 class nsIParser;
15 class nsIDOMNode;
16 class nsIURI;
17 class nsIChannel;
18
19 namespace mozilla {
20 namespace dom {
21
22 class XMLDocument : public nsDocument
23 {
24 public:
25 XMLDocument(const char* aContentType = "application/xml");
26 virtual ~XMLDocument();
27
28 NS_DECL_ISUPPORTS_INHERITED
29
30 virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE;
31 virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
32 nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
33
34 virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
35 nsILoadGroup* aLoadGroup,
36 nsISupports* aContainer,
37 nsIStreamListener **aDocListener,
38 bool aReset = true,
39 nsIContentSink* aSink = nullptr) MOZ_OVERRIDE;
40
41 virtual void EndLoad() MOZ_OVERRIDE;
42
43 // nsIDOMXMLDocument
44 NS_DECL_NSIDOMXMLDOCUMENT
45
46 virtual nsresult Init() MOZ_OVERRIDE;
47
48 virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
49
50 virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
51 // DocAddSizeOfIncludingThis is inherited from nsIDocument.
52
53
54 // WebIDL API
55 bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv);
56 bool Async() const
57 {
58 return mAsync;
59 }
60 // The XPCOM SetAsync is ok for us
61
62 // .location is [Unforgeable], so we have to make it clear that the
63 // nsIDocument version applies to us (it's shadowed by the XPCOM thing on
64 // nsDocument).
65 using nsIDocument::GetLocation;
66 // But then we need to also pull in the nsDocument XPCOM version
67 // because nsXULDocument tries to forward to it.
68 using nsDocument::GetLocation;
69
70 protected:
71 virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
72
73 // mChannelIsPending indicates whether we're currently asynchronously loading
74 // data from mChannel (via document.load() or normal load). It's set to true
75 // when we first find out about the channel (StartDocumentLoad) and set to
76 // false in EndLoad or if ResetToURI() is called. In the latter case our
77 // mChannel is also cancelled. Note that if this member is true, mChannel
78 // cannot be null.
79 bool mChannelIsPending;
80 bool mAsync;
81 bool mLoopingForSyncLoad;
82 };
83
84 } // namespace dom
85 } // namespace mozilla
86
87 #endif // mozilla_dom_XMLDocument_h

mercurial