/work/obj-fuzz/dist/include/mozilla/dom/HTMLIFrameElement.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_HTMLIFrameElement_h |
8 | | #define mozilla_dom_HTMLIFrameElement_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "nsGenericHTMLFrameElement.h" |
12 | | #include "nsDOMTokenList.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | class HTMLIFrameElement final : public nsGenericHTMLFrameElement |
18 | | { |
19 | | public: |
20 | | explicit HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
21 | | FromParser aFromParser = NOT_FROM_PARSER); |
22 | | |
23 | | NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLIFrameElement, iframe) |
24 | | |
25 | | // nsISupports |
26 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLIFrameElement, |
27 | | nsGenericHTMLFrameElement) |
28 | | |
29 | | // Element |
30 | | virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override |
31 | 0 | { |
32 | 0 | return true; |
33 | 0 | } |
34 | | |
35 | | // nsIContent |
36 | | virtual bool ParseAttribute(int32_t aNamespaceID, |
37 | | nsAtom* aAttribute, |
38 | | const nsAString& aValue, |
39 | | nsIPrincipal* aMaybeScriptedPrincipal, |
40 | | nsAttrValue& aResult) override; |
41 | | NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; |
42 | | virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override; |
43 | | |
44 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
45 | | |
46 | | uint32_t GetSandboxFlags(); |
47 | | |
48 | | // Web IDL binding methods |
49 | | void GetSrc(nsString& aSrc) const |
50 | 0 | { |
51 | 0 | GetURIAttr(nsGkAtoms::src, nullptr, aSrc); |
52 | 0 | } |
53 | | void SetSrc(const nsAString& aSrc, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError) |
54 | 0 | { |
55 | 0 | SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aError); |
56 | 0 | } |
57 | | void GetSrcdoc(DOMString& aSrcdoc) |
58 | 0 | { |
59 | 0 | GetHTMLAttr(nsGkAtoms::srcdoc, aSrcdoc); |
60 | 0 | } |
61 | | void SetSrcdoc(const nsAString& aSrcdoc, ErrorResult& aError) |
62 | 0 | { |
63 | 0 | SetHTMLAttr(nsGkAtoms::srcdoc, aSrcdoc, aError); |
64 | 0 | } |
65 | | void GetName(DOMString& aName) |
66 | 0 | { |
67 | 0 | GetHTMLAttr(nsGkAtoms::name, aName); |
68 | 0 | } |
69 | | void SetName(const nsAString& aName, ErrorResult& aError) |
70 | 0 | { |
71 | 0 | SetHTMLAttr(nsGkAtoms::name, aName, aError); |
72 | 0 | } |
73 | | nsDOMTokenList* Sandbox() |
74 | 0 | { |
75 | 0 | return GetTokenList(nsGkAtoms::sandbox, sSupportedSandboxTokens); |
76 | 0 | } |
77 | | bool AllowFullscreen() const |
78 | 0 | { |
79 | 0 | return GetBoolAttr(nsGkAtoms::allowfullscreen); |
80 | 0 | } |
81 | | void SetAllowFullscreen(bool aAllow, ErrorResult& aError) |
82 | 0 | { |
83 | 0 | SetHTMLBoolAttr(nsGkAtoms::allowfullscreen, aAllow, aError); |
84 | 0 | } |
85 | | bool AllowPaymentRequest() const |
86 | 0 | { |
87 | 0 | return GetBoolAttr(nsGkAtoms::allowpaymentrequest); |
88 | 0 | } |
89 | | void SetAllowPaymentRequest(bool aAllow, ErrorResult& aError) |
90 | 0 | { |
91 | 0 | SetHTMLBoolAttr(nsGkAtoms::allowpaymentrequest, aAllow, aError); |
92 | 0 | } |
93 | | void GetWidth(DOMString& aWidth) |
94 | 0 | { |
95 | 0 | GetHTMLAttr(nsGkAtoms::width, aWidth); |
96 | 0 | } |
97 | | void SetWidth(const nsAString& aWidth, ErrorResult& aError) |
98 | 0 | { |
99 | 0 | SetHTMLAttr(nsGkAtoms::width, aWidth, aError); |
100 | 0 | } |
101 | | void GetHeight(DOMString& aHeight) |
102 | 0 | { |
103 | 0 | GetHTMLAttr(nsGkAtoms::height, aHeight); |
104 | 0 | } |
105 | | void SetHeight(const nsAString& aHeight, ErrorResult& aError) |
106 | 0 | { |
107 | 0 | SetHTMLAttr(nsGkAtoms::height, aHeight, aError); |
108 | 0 | } |
109 | | using nsGenericHTMLFrameElement::GetContentDocument; |
110 | | using nsGenericHTMLFrameElement::GetContentWindow; |
111 | | void GetAlign(DOMString& aAlign) |
112 | 0 | { |
113 | 0 | GetHTMLAttr(nsGkAtoms::align, aAlign); |
114 | 0 | } |
115 | | void SetAlign(const nsAString& aAlign, ErrorResult& aError) |
116 | 0 | { |
117 | 0 | SetHTMLAttr(nsGkAtoms::align, aAlign, aError); |
118 | 0 | } |
119 | | void GetScrolling(DOMString& aScrolling) |
120 | 0 | { |
121 | 0 | GetHTMLAttr(nsGkAtoms::scrolling, aScrolling); |
122 | 0 | } |
123 | | void SetScrolling(const nsAString& aScrolling, ErrorResult& aError) |
124 | 0 | { |
125 | 0 | SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError); |
126 | 0 | } |
127 | | void GetFrameBorder(DOMString& aFrameBorder) |
128 | 0 | { |
129 | 0 | GetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder); |
130 | 0 | } |
131 | | void SetFrameBorder(const nsAString& aFrameBorder, ErrorResult& aError) |
132 | 0 | { |
133 | 0 | SetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder, aError); |
134 | 0 | } |
135 | | void GetLongDesc(nsAString& aLongDesc) const |
136 | 0 | { |
137 | 0 | GetURIAttr(nsGkAtoms::longdesc, nullptr, aLongDesc); |
138 | 0 | } |
139 | | void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError) |
140 | 0 | { |
141 | 0 | SetHTMLAttr(nsGkAtoms::longdesc, aLongDesc, aError); |
142 | 0 | } |
143 | | void GetMarginWidth(DOMString& aMarginWidth) |
144 | 0 | { |
145 | 0 | GetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth); |
146 | 0 | } |
147 | | void SetMarginWidth(const nsAString& aMarginWidth, ErrorResult& aError) |
148 | 0 | { |
149 | 0 | SetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth, aError); |
150 | 0 | } |
151 | | void GetMarginHeight(DOMString& aMarginHeight) |
152 | 0 | { |
153 | 0 | GetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight); |
154 | 0 | } |
155 | | void SetMarginHeight(const nsAString& aMarginHeight, ErrorResult& aError) |
156 | 0 | { |
157 | 0 | SetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight, aError); |
158 | 0 | } |
159 | | void SetReferrerPolicy(const nsAString& aReferrer, ErrorResult& aError) |
160 | 0 | { |
161 | 0 | SetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrer, aError); |
162 | 0 | } |
163 | | void GetReferrerPolicy(nsAString& aReferrer) |
164 | 0 | { |
165 | 0 | GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer); |
166 | 0 | } |
167 | | nsIDocument* |
168 | | GetSVGDocument(nsIPrincipal& aSubjectPrincipal) |
169 | 0 | { |
170 | 0 | return GetContentDocument(aSubjectPrincipal); |
171 | 0 | } |
172 | | bool Mozbrowser() const |
173 | 0 | { |
174 | 0 | return GetBoolAttr(nsGkAtoms::mozbrowser); |
175 | 0 | } |
176 | | void SetMozbrowser(bool aAllow, ErrorResult& aError) |
177 | 0 | { |
178 | 0 | SetHTMLBoolAttr(nsGkAtoms::mozbrowser, aAllow, aError); |
179 | 0 | } |
180 | | using nsGenericHTMLFrameElement::SetMozbrowser; |
181 | | // nsGenericHTMLFrameElement::GetFrameLoader is fine |
182 | | // nsGenericHTMLFrameElement::GetAppManifestURL is fine |
183 | | |
184 | | // The fullscreen flag is set to true only when requestFullscreen is |
185 | | // explicitly called on this <iframe> element. In case this flag is |
186 | | // set, the fullscreen state of this element will not be reverted |
187 | | // automatically when its subdocument exits fullscreen. |
188 | 0 | bool FullscreenFlag() const { return mFullscreenFlag; } |
189 | 0 | void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; } |
190 | | |
191 | | protected: |
192 | | virtual ~HTMLIFrameElement(); |
193 | | |
194 | | virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
195 | | |
196 | | virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, |
197 | | const nsAttrValue* aValue, |
198 | | const nsAttrValue* aOldValue, |
199 | | nsIPrincipal* aMaybeScriptedPrincipal, |
200 | | bool aNotify) override; |
201 | | virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsAtom* aName, |
202 | | const nsAttrValueOrString& aValue, |
203 | | bool aNotify) override; |
204 | | |
205 | | private: |
206 | | static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, |
207 | | MappedDeclarations&); |
208 | | |
209 | | static const DOMTokenListSupportedToken sSupportedSandboxTokens[]; |
210 | | |
211 | | /** |
212 | | * This function is called by AfterSetAttr and OnAttrSetButNotChanged. |
213 | | * This function will be called by AfterSetAttr whether the attribute is being |
214 | | * set or unset. |
215 | | * |
216 | | * @param aNamespaceID the namespace of the attr being set |
217 | | * @param aName the localname of the attribute being set |
218 | | * @param aNotify Whether we plan to notify document observers. |
219 | | */ |
220 | | void AfterMaybeChangeAttr(int32_t aNamespaceID, nsAtom* aName, bool aNotify); |
221 | | }; |
222 | | |
223 | | } // namespace dom |
224 | | } // namespace mozilla |
225 | | |
226 | | #endif |