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.
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/. */
6 #ifndef mozilla_dom_XMLDocument_h
7 #define mozilla_dom_XMLDocument_h
9 #include "mozilla/Attributes.h"
10 #include "nsDocument.h"
11 #include "nsIDOMXMLDocument.h"
12 #include "nsIScriptContext.h"
14 class nsIParser;
15 class nsIDOMNode;
16 class nsIURI;
17 class nsIChannel;
19 namespace mozilla {
20 namespace dom {
22 class XMLDocument : public nsDocument
23 {
24 public:
25 XMLDocument(const char* aContentType = "application/xml");
26 virtual ~XMLDocument();
28 NS_DECL_ISUPPORTS_INHERITED
30 virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE;
31 virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
32 nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
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;
41 virtual void EndLoad() MOZ_OVERRIDE;
43 // nsIDOMXMLDocument
44 NS_DECL_NSIDOMXMLDOCUMENT
46 virtual nsresult Init() MOZ_OVERRIDE;
48 virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
50 virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
51 // DocAddSizeOfIncludingThis is inherited from nsIDocument.
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
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;
70 protected:
71 virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
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 };
84 } // namespace dom
85 } // namespace mozilla
87 #endif // mozilla_dom_XMLDocument_h