1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.html;
16
17 import org.htmlunit.html.BaseFrameElement;
18 import org.htmlunit.html.FrameWindow;
19 import org.htmlunit.html.FrameWindow.PageDenied;
20 import org.htmlunit.html.HtmlFrame;
21 import org.htmlunit.javascript.configuration.JsxClass;
22 import org.htmlunit.javascript.configuration.JsxConstructor;
23 import org.htmlunit.javascript.configuration.JsxGetter;
24 import org.htmlunit.javascript.configuration.JsxSetter;
25 import org.htmlunit.javascript.host.Window;
26 import org.htmlunit.javascript.host.WindowProxy;
27
28
29
30
31
32
33
34
35
36
37 @JsxClass(domClass = HtmlFrame.class)
38 public class HTMLFrameElement extends HTMLElement {
39
40
41
42
43 @Override
44 @JsxConstructor
45 public void jsConstructor() {
46 super.jsConstructor();
47 }
48
49
50
51
52
53 @JsxGetter
54 public String getSrc() {
55 return getFrame().getSrcAttribute();
56 }
57
58
59
60
61
62 @JsxSetter
63 public void setSrc(final String src) {
64 getFrame().setSrcAttribute(src);
65 }
66
67
68
69
70
71
72 @JsxGetter
73 public DocumentProxy getContentDocument() {
74 final FrameWindow frameWindow = getFrame().getEnclosedWindow();
75 if (PageDenied.NONE != frameWindow.getPageDenied()) {
76 return null;
77 }
78 return ((Window) frameWindow.getScriptableObject()).getDocument_js();
79 }
80
81
82
83
84
85
86
87 @JsxGetter
88 public WindowProxy getContentWindow() {
89 return Window.getProxy(getFrame().getEnclosedWindow());
90 }
91
92
93
94
95
96 @JsxGetter
97 @Override
98 public String getName() {
99 return getFrame().getNameAttribute();
100 }
101
102
103
104
105
106 @JsxSetter
107 @Override
108 public void setName(final String name) {
109 getFrame().setNameAttribute(name);
110 }
111
112 private BaseFrameElement getFrame() {
113 return (BaseFrameElement) getDomNodeOrDie();
114 }
115
116
117
118
119 @Override
120 protected boolean isEndTagForbidden() {
121 return true;
122 }
123 }