michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_XMLDocument_h michael@0: #define mozilla_dom_XMLDocument_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsDocument.h" michael@0: #include "nsIDOMXMLDocument.h" michael@0: #include "nsIScriptContext.h" michael@0: michael@0: class nsIParser; michael@0: class nsIDOMNode; michael@0: class nsIURI; michael@0: class nsIChannel; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class XMLDocument : public nsDocument michael@0: { michael@0: public: michael@0: XMLDocument(const char* aContentType = "application/xml"); michael@0: virtual ~XMLDocument(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE; michael@0: virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, michael@0: nsIPrincipal* aPrincipal) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel, michael@0: nsILoadGroup* aLoadGroup, michael@0: nsISupports* aContainer, michael@0: nsIStreamListener **aDocListener, michael@0: bool aReset = true, michael@0: nsIContentSink* aSink = nullptr) MOZ_OVERRIDE; michael@0: michael@0: virtual void EndLoad() MOZ_OVERRIDE; michael@0: michael@0: // nsIDOMXMLDocument michael@0: NS_DECL_NSIDOMXMLDOCUMENT michael@0: michael@0: virtual nsresult Init() MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; michael@0: michael@0: virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE; michael@0: // DocAddSizeOfIncludingThis is inherited from nsIDocument. michael@0: michael@0: michael@0: // WebIDL API michael@0: bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv); michael@0: bool Async() const michael@0: { michael@0: return mAsync; michael@0: } michael@0: // The XPCOM SetAsync is ok for us michael@0: michael@0: // .location is [Unforgeable], so we have to make it clear that the michael@0: // nsIDocument version applies to us (it's shadowed by the XPCOM thing on michael@0: // nsDocument). michael@0: using nsIDocument::GetLocation; michael@0: // But then we need to also pull in the nsDocument XPCOM version michael@0: // because nsXULDocument tries to forward to it. michael@0: using nsDocument::GetLocation; michael@0: michael@0: protected: michael@0: virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE; michael@0: michael@0: // mChannelIsPending indicates whether we're currently asynchronously loading michael@0: // data from mChannel (via document.load() or normal load). It's set to true michael@0: // when we first find out about the channel (StartDocumentLoad) and set to michael@0: // false in EndLoad or if ResetToURI() is called. In the latter case our michael@0: // mChannel is also cancelled. Note that if this member is true, mChannel michael@0: // cannot be null. michael@0: bool mChannelIsPending; michael@0: bool mAsync; michael@0: bool mLoopingForSyncLoad; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_XMLDocument_h