2015-05-03 22:32:37 +03: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 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"
|
2017-02-01 23:43:38 +03:00
|
|
|
#include "mozilla/dom/BindingDeclarations.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 {
|
|
|
|
|
2016-09-28 22:46:44 +03:00
|
|
|
class XMLDocument : public nsDocument,
|
|
|
|
public nsIDOMXMLDocument
|
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
|
|
|
|
2016-08-29 23:30:36 +03:00
|
|
|
virtual void SetSuppressParserErrorElement(bool aSuppress) override;
|
|
|
|
virtual bool SuppressParserErrorElement() override;
|
|
|
|
|
2016-09-21 20:48:05 +03:00
|
|
|
virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) override;
|
|
|
|
virtual bool SuppressParserErrorConsoleMessages() override;
|
|
|
|
|
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
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) 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
|
2017-02-01 23:43:38 +03:00
|
|
|
bool Load(const nsAString& aUrl, CallerType aCallerType, ErrorResult& aRv);
|
2013-03-26 19:31:54 +04:00
|
|
|
bool Async() const
|
|
|
|
{
|
|
|
|
return mAsync;
|
|
|
|
}
|
2016-09-28 22:46:44 +03:00
|
|
|
void SetAsync(bool aAsync)
|
|
|
|
{
|
|
|
|
mAsync = aAsync;
|
|
|
|
}
|
2013-03-26 19:31:54 +04:00
|
|
|
|
|
|
|
// .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;
|
|
|
|
|
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;
|
2016-08-29 23:30:36 +03:00
|
|
|
|
|
|
|
// If true, do not output <parsererror> elements. Per spec, XMLHttpRequest
|
|
|
|
// shouldn't output them, whereas DOMParser/others should (see bug 918703).
|
|
|
|
bool mSuppressParserErrorElement;
|
2016-09-21 20:48:05 +03:00
|
|
|
|
|
|
|
// If true, do not log parsing errors to the web console (see bug 884693).
|
|
|
|
bool mSuppressParserErrorConsoleMessages;
|
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
|