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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
use super::*;
/// The TrustedTypePolicyFactory class.
/// [`TrustedTypePolicyFactory`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct TrustedTypePolicyFactory {
inner: Any,
}
impl FromVal for TrustedTypePolicyFactory {
fn from_val(v: &Any) -> Self {
TrustedTypePolicyFactory {
inner: Any::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 TrustedTypePolicyFactory {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for TrustedTypePolicyFactory {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for TrustedTypePolicyFactory {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for TrustedTypePolicyFactory {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<TrustedTypePolicyFactory> for Any {
fn from(s: TrustedTypePolicyFactory) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&TrustedTypePolicyFactory> for Any {
fn from(s: &TrustedTypePolicyFactory) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(TrustedTypePolicyFactory);
impl TrustedTypePolicyFactory {
/// Getter of the `emptyHTML` attribute.
/// [`TrustedTypePolicyFactory.emptyHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/emptyHTML)
pub fn empty_html(&self) -> TrustedHTML {
self.inner.get("emptyHTML").as_::<TrustedHTML>()
}
}
impl TrustedTypePolicyFactory {
/// Getter of the `emptyScript` attribute.
/// [`TrustedTypePolicyFactory.emptyScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/emptyScript)
pub fn empty_script(&self) -> TrustedScript {
self.inner.get("emptyScript").as_::<TrustedScript>()
}
}
impl TrustedTypePolicyFactory {
/// Getter of the `defaultPolicy` attribute.
/// [`TrustedTypePolicyFactory.defaultPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/defaultPolicy)
pub fn default_policy(&self) -> TrustedTypePolicy {
self.inner.get("defaultPolicy").as_::<TrustedTypePolicy>()
}
}
impl TrustedTypePolicyFactory {
/// The createPolicy method.
/// [`TrustedTypePolicyFactory.createPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/createPolicy)
pub fn create_policy(&self, policy_name: &JsString) -> TrustedTypePolicy {
self.inner
.call("createPolicy", &[policy_name.into()])
.as_::<TrustedTypePolicy>()
}
}
impl TrustedTypePolicyFactory {
/// The createPolicy method.
/// [`TrustedTypePolicyFactory.createPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/createPolicy)
pub fn create_policy_with_policy_options(
&self,
policy_name: &JsString,
policy_options: &TrustedTypePolicyOptions,
) -> TrustedTypePolicy {
self.inner
.call("createPolicy", &[policy_name.into(), policy_options.into()])
.as_::<TrustedTypePolicy>()
}
}
impl TrustedTypePolicyFactory {
/// The isHTML method.
/// [`TrustedTypePolicyFactory.isHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML)
pub fn is_html(&self, value: &Any) -> bool {
self.inner.call("isHTML", &[value.into()]).as_::<bool>()
}
}
impl TrustedTypePolicyFactory {
/// The isScript method.
/// [`TrustedTypePolicyFactory.isScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript)
pub fn is_script(&self, value: &Any) -> bool {
self.inner.call("isScript", &[value.into()]).as_::<bool>()
}
}
impl TrustedTypePolicyFactory {
/// The isScriptURL method.
/// [`TrustedTypePolicyFactory.isScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL)
pub fn is_script_url(&self, value: &Any) -> bool {
self.inner
.call("isScriptURL", &[value.into()])
.as_::<bool>()
}
}
impl TrustedTypePolicyFactory {
/// The getAttributeType method.
/// [`TrustedTypePolicyFactory.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType)
pub fn get_attribute_type(&self, tag_name: &JsString, attribute: &JsString) -> JsString {
self.inner
.call("getAttributeType", &[tag_name.into(), attribute.into()])
.as_::<JsString>()
}
}
impl TrustedTypePolicyFactory {
/// The getAttributeType method.
/// [`TrustedTypePolicyFactory.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType)
pub fn get_attribute_type_with_element_ns(
&self,
tag_name: &JsString,
attribute: &JsString,
element_ns: &JsString,
) -> JsString {
self.inner
.call(
"getAttributeType",
&[tag_name.into(), attribute.into(), element_ns.into()],
)
.as_::<JsString>()
}
}
impl TrustedTypePolicyFactory {
/// The getAttributeType method.
/// [`TrustedTypePolicyFactory.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType)
pub fn get_attribute_type_with_element_ns_and_attr_ns(
&self,
tag_name: &JsString,
attribute: &JsString,
element_ns: &JsString,
attr_ns: &JsString,
) -> JsString {
self.inner
.call(
"getAttributeType",
&[
tag_name.into(),
attribute.into(),
element_ns.into(),
attr_ns.into(),
],
)
.as_::<JsString>()
}
}
impl TrustedTypePolicyFactory {
/// The getPropertyType method.
/// [`TrustedTypePolicyFactory.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType)
pub fn get_property_type(&self, tag_name: &JsString, property: &JsString) -> JsString {
self.inner
.call("getPropertyType", &[tag_name.into(), property.into()])
.as_::<JsString>()
}
}
impl TrustedTypePolicyFactory {
/// The getPropertyType method.
/// [`TrustedTypePolicyFactory.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType)
pub fn get_property_type_with_element_ns(
&self,
tag_name: &JsString,
property: &JsString,
element_ns: &JsString,
) -> JsString {
self.inner
.call(
"getPropertyType",
&[tag_name.into(), property.into(), element_ns.into()],
)
.as_::<JsString>()
}
}