2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2013-03-20 20:22:26 +04:00
|
|
|
#ifndef mozilla_dom_XMLDocument_h
|
|
|
|
#define mozilla_dom_XMLDocument_h
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-03-26 10:41:30 +03:00
|
|
|
#include "nsDocument.h"
|
2001-09-21 05:07:53 +04:00
|
|
|
#include "nsIDOMXMLDocument.h"
|
2002-06-15 03:54:18 +04:00
|
|
|
#include "nsIScriptContext.h"
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2001-05-01 03:35:09 +04:00
|
|
|
class nsIURI;
|
2005-04-28 20:57:24 +04:00
|
|
|
class nsIChannel;
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2013-03-20 20:22:26 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class XMLDocument : public nsDocument
|
1998-11-12 01:06:16 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit XMLDocument(const char* aContentType = "application/xml");
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2004-07-28 11:08:41 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
|
2006-11-22 21:27:54 +03:00
|
|
|
virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIPrincipal* aPrincipal) override;
|
2001-03-12 09:39:27 +03:00
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener **aDocListener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aReset = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIContentSink* aSink = nullptr) override;
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EndLoad() override;
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2001-09-21 05:07:53 +04:00
|
|
|
// nsIDOMXMLDocument
|
|
|
|
NS_DECL_NSIDOMXMLDOCUMENT
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Init() override;
|
2003-03-26 10:41:30 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2006-09-05 14:22:54 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const override;
|
2013-10-01 03:20:23 +04:00
|
|
|
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
2012-02-02 01:58:01 +04:00
|
|
|
|
2013-03-26 19:31:54 +04:00
|
|
|
|
|
|
|
// WebIDL API
|
|
|
|
bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv);
|
|
|
|
bool Async() const
|
|
|
|
{
|
|
|
|
return mAsync;
|
|
|
|
}
|
|
|
|
// The XPCOM SetAsync is ok for us
|
|
|
|
|
|
|
|
// .location is [Unforgeable], so we have to make it clear that the
|
|
|
|
// nsIDocument version applies to us (it's shadowed by the XPCOM thing on
|
|
|
|
// nsDocument).
|
|
|
|
using nsIDocument::GetLocation;
|
|
|
|
// But then we need to also pull in the nsDocument XPCOM version
|
|
|
|
// because nsXULDocument tries to forward to it.
|
|
|
|
using nsDocument::GetLocation;
|
|
|
|
|
1998-11-12 01:06:16 +03:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~XMLDocument();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-03-26 19:31:54 +04:00
|
|
|
|
2014-06-03 19:38:37 +04:00
|
|
|
friend nsresult (::NS_NewXMLDocument)(nsIDocument**, bool, bool);
|
|
|
|
|
|
|
|
|
2005-06-01 05:15:23 +04:00
|
|
|
// mChannelIsPending indicates whether we're currently asynchronously loading
|
|
|
|
// data from mChannel (via document.load() or normal load). It's set to true
|
|
|
|
// when we first find out about the channel (StartDocumentLoad) and set to
|
|
|
|
// false in EndLoad or if ResetToURI() is called. In the latter case our
|
|
|
|
// mChannel is also cancelled. Note that if this member is true, mChannel
|
|
|
|
// cannot be null.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mChannelIsPending;
|
|
|
|
bool mAsync;
|
|
|
|
bool mLoopingForSyncLoad;
|
2014-06-03 19:38:37 +04:00
|
|
|
|
|
|
|
// If true. we're really a Document, not an XMLDocument
|
|
|
|
bool mIsPlainDocument;
|
1998-11-12 01:06:16 +03:00
|
|
|
};
|
|
|
|
|
2013-03-20 20:22:26 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
1998-11-12 01:06:16 +03:00
|
|
|
|
2013-03-20 20:22:26 +04:00
|
|
|
#endif // mozilla_dom_XMLDocument_h
|