Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/parser/xml/nsSAXXMLReader.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef nsSAXXMLReader_h__
7
#define nsSAXXMLReader_h__
8
9
#include "nsCOMPtr.h"
10
#include "nsIContentSink.h"
11
#include "nsIExpatSink.h"
12
#include "nsIParser.h"
13
#include "nsIURI.h"
14
#include "nsISAXXMLReader.h"
15
#include "nsISAXContentHandler.h"
16
#include "nsISAXErrorHandler.h"
17
#include "nsCycleCollectionParticipant.h"
18
#include "mozilla/Attributes.h"
19
#include "mozilla/NotNull.h"
20
21
#define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1"
22
#define NS_SAXXMLREADER_CID  \
23
{ 0xab1da296, 0x6125, 0x40ba, \
24
{ 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} }
25
26
class nsSAXXMLReader final : public nsISAXXMLReader,
27
                             public nsIExpatSink,
28
                             public nsIContentSink
29
{
30
public:
31
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32
  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader)
33
  NS_DECL_NSIEXPATSINK
34
  NS_DECL_NSISAXXMLREADER
35
  NS_DECL_NSIREQUESTOBSERVER
36
  NS_DECL_NSISTREAMLISTENER
37
38
  nsSAXXMLReader();
39
40
  //nsIContentSink
41
  NS_IMETHOD WillParse() override
42
0
  {
43
0
    return NS_OK;
44
0
  }
45
46
  NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
47
  NS_IMETHOD DidBuildModel(bool aTerminated) override;
48
  NS_IMETHOD SetParser(nsParserBase* aParser) override;
49
  
50
  NS_IMETHOD WillInterrupt() override
51
0
  {
52
0
    return NS_OK;
53
0
  }
54
55
  NS_IMETHOD WillResume() override
56
0
  {
57
0
    return NS_OK;
58
0
  }
59
  
60
  virtual void FlushPendingNotifications(mozilla::FlushType aType) override
61
0
  {
62
0
  }
63
  
64
  virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override
65
0
  {
66
0
  }
67
  
68
  virtual nsISupports *GetTarget() override
69
0
  {
70
0
    return nullptr;
71
0
  }
72
73
private:
74
0
  ~nsSAXXMLReader() {}
75
76
  nsCOMPtr<nsISAXContentHandler> mContentHandler;
77
  nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
78
  nsCOMPtr<nsIURI> mBaseURI;
79
  nsCOMPtr<nsIStreamListener> mListener;
80
  nsCOMPtr<nsIRequestObserver> mParserObserver;
81
  bool mIsAsyncParse;
82
  static bool TryChannelCharset(nsIChannel *aChannel,
83
                                int32_t& aCharsetSource,
84
                                NotNull<const Encoding*>& aEncoding);
85
  nsresult EnsureBaseURI();
86
  nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
87
  nsresult SplitExpatName(const char16_t *aExpatName,
88
                          nsString &aURI,
89
                          nsString &aLocalName,
90
                          nsString &aQName);
91
};
92
93
#endif // nsSAXXMLReader_h__