2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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-11 22:06:16 +00:00
|
|
|
|
2013-03-20 16:22:26 +00:00
|
|
|
#ifndef mozilla_dom_XMLDocument_h
|
|
|
|
#define mozilla_dom_XMLDocument_h
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-03-26 07:41:30 +00:00
|
|
|
#include "nsDocument.h"
|
2001-09-21 01:07:53 +00:00
|
|
|
#include "nsIDOMXMLDocument.h"
|
2002-06-14 23:54:18 +00:00
|
|
|
#include "nsIScriptContext.h"
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2001-04-30 23:35:09 +00:00
|
|
|
class nsIURI;
|
2005-04-28 16:57:24 +00:00
|
|
|
class nsIChannel;
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2013-03-20 16:22:26 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class XMLDocument : public nsDocument
|
1998-11-11 22:06:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit XMLDocument(const char* aContentType = "application/xml");
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2004-07-28 07:08:41 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
|
2006-11-22 18:27:54 +00:00
|
|
|
virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIPrincipal* aPrincipal) override;
|
2001-03-12 06:39:27 +00:00
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener **aDocListener,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aReset = true,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIContentSink* aSink = nullptr) override;
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void EndLoad() override;
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2001-09-21 01:07:53 +00:00
|
|
|
// nsIDOMXMLDocument
|
|
|
|
NS_DECL_NSIDOMXMLDOCUMENT
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Init() override;
|
2003-03-26 07:41:30 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2006-09-05 10:22:54 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const override;
|
2013-09-30 23:20:23 +00:00
|
|
|
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
2012-02-01 21:58:01 +00:00
|
|
|
|
2013-03-26 15:31:54 +00: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-11 22:06:16 +00:00
|
|
|
protected:
|
2014-07-08 21:23:16 +00:00
|
|
|
virtual ~XMLDocument();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-03-26 15:31:54 +00:00
|
|
|
|
2014-06-03 15:38:37 +00:00
|
|
|
friend nsresult (::NS_NewXMLDocument)(nsIDocument**, bool, bool);
|
|
|
|
|
|
|
|
|
2005-06-01 01:15:23 +00: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 06:19:26 +00:00
|
|
|
bool mChannelIsPending;
|
|
|
|
bool mAsync;
|
|
|
|
bool mLoopingForSyncLoad;
|
2014-06-03 15:38:37 +00:00
|
|
|
|
|
|
|
// If true. we're really a Document, not an XMLDocument
|
|
|
|
bool mIsPlainDocument;
|
1998-11-11 22:06:16 +00:00
|
|
|
};
|
|
|
|
|
2013-03-20 16:22:26 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2013-03-20 16:22:26 +00:00
|
|
|
#endif // mozilla_dom_XMLDocument_h
|