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"
|
2019-01-02 16:05:23 +03:00
|
|
|
#include "mozilla/dom/Document.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 {
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
class XMLDocument : public Document {
|
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
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, Document)
|
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,
|
2019-04-12 08:31:32 +03:00
|
|
|
nsIPrincipal* aPrincipal,
|
|
|
|
nsIPrincipal* aStoragePrincipal) 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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Init() override;
|
2003-03-26 10:41:30 +03:00
|
|
|
|
2018-08-09 02:58:44 +03:00
|
|
|
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
2006-09-05 14:22:54 +04:00
|
|
|
|
2017-08-10 07:13:22 +03:00
|
|
|
virtual void DocAddSizeOfExcludingThis(
|
|
|
|
nsWindowSizes& aWindowSizes) const override;
|
2019-01-02 16:05:23 +03:00
|
|
|
// DocAddSizeOfIncludingThis is inherited from Document.
|
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
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
// .location is [Unforgeable], so we have to make it clear that the Document
|
|
|
|
// version applies to us (it's shadowed by the XPCOM thing on Document).
|
|
|
|
using Document::GetLocation;
|
2013-03-26 19:31:54 +04:00
|
|
|
|
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;
|
2014-06-03 19:38:37 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
friend nsresult(::NS_NewXMLDocument)(Document**, bool, bool);
|
2014-06-03 19:38:37 +04:00
|
|
|
|
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
|