1use dom_struct::dom_struct;
6use script_bindings::reflector::Reflector;
7use servo_url::ServoUrl;
8use uuid::Uuid;
9
10use crate::dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, FrameType};
11use crate::dom::bindings::root::MutNullableDom;
12use crate::dom::bindings::str::{DOMString, USVString};
13use crate::dom::serviceworker::ServiceWorker;
14
15#[dom_struct]
16pub(crate) struct Client {
17 reflector_: Reflector,
18 active_worker: MutNullableDom<ServiceWorker>,
19 #[no_trace]
20 url: ServoUrl,
21 frame_type: FrameType,
22 #[no_trace]
23 id: Uuid,
24}
25
26impl ClientMethods<crate::DomTypeHolder> for Client {
27 fn Url(&self) -> USVString {
29 USVString(self.url.as_str().to_owned())
30 }
31
32 fn FrameType(&self) -> FrameType {
34 self.frame_type
35 }
36
37 fn Id(&self) -> DOMString {
39 format!("{}", self.id).into()
40 }
41}