1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
use super::*;
/// The SecurityPolicyViolationEvent class.
/// [`SecurityPolicyViolationEvent`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct SecurityPolicyViolationEvent {
inner: Event,
}
impl FromVal for SecurityPolicyViolationEvent {
fn from_val(v: &Any) -> Self {
SecurityPolicyViolationEvent {
inner: Event::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for SecurityPolicyViolationEvent {
type Target = Event;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for SecurityPolicyViolationEvent {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for SecurityPolicyViolationEvent {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for SecurityPolicyViolationEvent {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<SecurityPolicyViolationEvent> for Any {
fn from(s: SecurityPolicyViolationEvent) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&SecurityPolicyViolationEvent> for Any {
fn from(s: &SecurityPolicyViolationEvent) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(SecurityPolicyViolationEvent);
impl SecurityPolicyViolationEvent {
/// Getter of the `documentURI` attribute.
/// [`SecurityPolicyViolationEvent.documentURI`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/documentURI)
pub fn document_uri(&self) -> JsString {
self.inner.get("documentURI").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `referrer` attribute.
/// [`SecurityPolicyViolationEvent.referrer`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/referrer)
pub fn referrer(&self) -> JsString {
self.inner.get("referrer").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `blockedURI` attribute.
/// [`SecurityPolicyViolationEvent.blockedURI`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/blockedURI)
pub fn blocked_uri(&self) -> JsString {
self.inner.get("blockedURI").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `effectiveDirective` attribute.
/// [`SecurityPolicyViolationEvent.effectiveDirective`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/effectiveDirective)
pub fn effective_directive(&self) -> JsString {
self.inner.get("effectiveDirective").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `violatedDirective` attribute.
/// [`SecurityPolicyViolationEvent.violatedDirective`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/violatedDirective)
pub fn violated_directive(&self) -> JsString {
self.inner.get("violatedDirective").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `originalPolicy` attribute.
/// [`SecurityPolicyViolationEvent.originalPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/originalPolicy)
pub fn original_policy(&self) -> JsString {
self.inner.get("originalPolicy").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `sourceFile` attribute.
/// [`SecurityPolicyViolationEvent.sourceFile`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/sourceFile)
pub fn source_file(&self) -> JsString {
self.inner.get("sourceFile").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `sample` attribute.
/// [`SecurityPolicyViolationEvent.sample`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/sample)
pub fn sample(&self) -> JsString {
self.inner.get("sample").as_::<JsString>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `disposition` attribute.
/// [`SecurityPolicyViolationEvent.disposition`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/disposition)
pub fn disposition(&self) -> SecurityPolicyViolationEventDisposition {
self.inner
.get("disposition")
.as_::<SecurityPolicyViolationEventDisposition>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `statusCode` attribute.
/// [`SecurityPolicyViolationEvent.statusCode`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/statusCode)
pub fn status_code(&self) -> u16 {
self.inner.get("statusCode").as_::<u16>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `lineNumber` attribute.
/// [`SecurityPolicyViolationEvent.lineNumber`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/lineNumber)
pub fn line_number(&self) -> u32 {
self.inner.get("lineNumber").as_::<u32>()
}
}
impl SecurityPolicyViolationEvent {
/// Getter of the `columnNumber` attribute.
/// [`SecurityPolicyViolationEvent.columnNumber`](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/columnNumber)
pub fn column_number(&self) -> u32 {
self.inner.get("columnNumber").as_::<u32>()
}
}
impl SecurityPolicyViolationEvent {
/// The `new SecurityPolicyViolationEvent(..)` constructor, creating a new SecurityPolicyViolationEvent instance
pub fn new(type_: &JsString) -> SecurityPolicyViolationEvent {
Self {
inner: Any::global("SecurityPolicyViolationEvent")
.new(&[type_.into()])
.as_::<Event>(),
}
}
}
impl SecurityPolicyViolationEvent {
/// The `new SecurityPolicyViolationEvent(..)` constructor, creating a new SecurityPolicyViolationEvent instance
pub fn new_with_event_init_dict(
type_: &JsString,
event_init_dict: &SecurityPolicyViolationEventInit,
) -> SecurityPolicyViolationEvent {
Self {
inner: Any::global("SecurityPolicyViolationEvent")
.new(&[type_.into(), event_init_dict.into()])
.as_::<Event>(),
}
}
}