content/xml/document/src/XMLDocument.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xml/document/src/XMLDocument.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_XMLDocument_h
    1.10 +#define mozilla_dom_XMLDocument_h
    1.11 +
    1.12 +#include "mozilla/Attributes.h"
    1.13 +#include "nsDocument.h"
    1.14 +#include "nsIDOMXMLDocument.h"
    1.15 +#include "nsIScriptContext.h"
    1.16 +
    1.17 +class nsIParser;
    1.18 +class nsIDOMNode;
    1.19 +class nsIURI;
    1.20 +class nsIChannel;
    1.21 +
    1.22 +namespace mozilla {
    1.23 +namespace dom {
    1.24 +
    1.25 +class XMLDocument : public nsDocument
    1.26 +{
    1.27 +public:
    1.28 +  XMLDocument(const char* aContentType = "application/xml");
    1.29 +  virtual ~XMLDocument();
    1.30 +
    1.31 +  NS_DECL_ISUPPORTS_INHERITED
    1.32 +
    1.33 +  virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE;
    1.34 +  virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
    1.35 +                          nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
    1.36 +
    1.37 +  virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
    1.38 +                                     nsILoadGroup* aLoadGroup,
    1.39 +                                     nsISupports* aContainer,
    1.40 +                                     nsIStreamListener **aDocListener,
    1.41 +                                     bool aReset = true,
    1.42 +                                     nsIContentSink* aSink = nullptr) MOZ_OVERRIDE;
    1.43 +
    1.44 +  virtual void EndLoad() MOZ_OVERRIDE;
    1.45 +
    1.46 +  // nsIDOMXMLDocument
    1.47 +  NS_DECL_NSIDOMXMLDOCUMENT
    1.48 +
    1.49 +  virtual nsresult Init() MOZ_OVERRIDE;
    1.50 +
    1.51 +  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
    1.52 +
    1.53 +  virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
    1.54 +  // DocAddSizeOfIncludingThis is inherited from nsIDocument.
    1.55 +
    1.56 +
    1.57 +  // WebIDL API
    1.58 +  bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv);
    1.59 +  bool Async() const
    1.60 +  {
    1.61 +    return mAsync;
    1.62 +  }
    1.63 +  // The XPCOM SetAsync is ok for us
    1.64 +
    1.65 +  // .location is [Unforgeable], so we have to make it clear that the
    1.66 +  // nsIDocument version applies to us (it's shadowed by the XPCOM thing on
    1.67 +  // nsDocument).
    1.68 +  using nsIDocument::GetLocation;
    1.69 +  // But then we need to also pull in the nsDocument XPCOM version
    1.70 +  // because nsXULDocument tries to forward to it.
    1.71 +  using nsDocument::GetLocation;
    1.72 +
    1.73 +protected:
    1.74 +  virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
    1.75 +
    1.76 +  // mChannelIsPending indicates whether we're currently asynchronously loading
    1.77 +  // data from mChannel (via document.load() or normal load).  It's set to true
    1.78 +  // when we first find out about the channel (StartDocumentLoad) and set to
    1.79 +  // false in EndLoad or if ResetToURI() is called.  In the latter case our
    1.80 +  // mChannel is also cancelled.  Note that if this member is true, mChannel
    1.81 +  // cannot be null.
    1.82 +  bool mChannelIsPending;
    1.83 +  bool mAsync;
    1.84 +  bool mLoopingForSyncLoad;
    1.85 +};
    1.86 +
    1.87 +} // namespace dom
    1.88 +} // namespace mozilla
    1.89 +
    1.90 +#endif // mozilla_dom_XMLDocument_h

mercurial