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