Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/ProcessingInstruction.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_ProcessingInstruction_h
8
#define mozilla_dom_ProcessingInstruction_h
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/dom/CharacterData.h"
12
#include "nsAString.h"
13
#include "nsStyleLinkElement.h"
14
15
class nsIPrincipal;
16
class nsIURI;
17
18
namespace mozilla {
19
namespace dom {
20
21
class ProcessingInstruction : public CharacterData
22
                            , public nsStyleLinkElement
23
{
24
public:
25
  ProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
26
                        const nsAString& aData);
27
28
  // nsISupports.  We need to declare QI, because nsStyleLinkElement
29
  // has a pure-virtual QI.
30
  NS_DECL_ISUPPORTS_INHERITED
31
32
  virtual already_AddRefed<CharacterData>
33
    CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
34
                  bool aCloneText) const override;
35
36
#ifdef DEBUG
37
  virtual void List(FILE* out, int32_t aIndent) const override;
38
  virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
39
#endif
40
41
  // WebIDL API
42
  void GetTarget(nsAString& aTarget)
43
0
  {
44
0
    aTarget = NodeName();
45
0
  }
46
47
  NS_IMPL_FROMNODE_HELPER(ProcessingInstruction, IsProcessingInstruction())
48
49
protected:
50
  virtual ~ProcessingInstruction();
51
52
  /**
53
   * This will parse the content of the PI, to extract the value of the pseudo
54
   * attribute with the name specified in aName. See
55
   * http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
56
   * which is used to parse the content of the PI.
57
   *
58
   * @param aName the name of the attribute to get the value for
59
   * @param aValue [out] the value for the attribute with name specified in
60
   *                     aAttribute. Empty if the attribute isn't present.
61
   */
62
  bool GetAttrValue(nsAtom *aName, nsAString& aValue);
63
64
  virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
65
66
  // nsStyleLinkElement overrides, because we can't leave them pure virtual.
67
  Maybe<SheetInfo> GetStyleSheetInfo() override;
68
};
69
70
} // namespace dom
71
} // namespace mozilla
72
73
/**
74
 * aNodeInfoManager must not be null.
75
 */
76
already_AddRefed<mozilla::dom::ProcessingInstruction>
77
NS_NewXMLProcessingInstruction(nsNodeInfoManager *aNodeInfoManager,
78
                               const nsAString& aTarget,
79
                               const nsAString& aData);
80
81
#endif // mozilla_dom_ProcessingInstruction_h