Skip to main content

script/dom/
windowclient.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use std::rc::Rc;
6
7use dom_struct::dom_struct;
8use js::context::JSContext;
9use script_bindings::codegen::GenericBindings::WindowClientBinding::WindowClientMethods;
10use script_bindings::str::USVString;
11
12use crate::dom::bindings::reflector::DomGlobal;
13use crate::dom::client::Client;
14use crate::dom::promise::Promise;
15
16#[dom_struct]
17pub(crate) struct WindowClient {
18    client: Client,
19}
20
21impl WindowClientMethods<crate::DomTypeHolder> for WindowClient {
22    /// <https://w3c.github.io/ServiceWorker/#dom-windowclient-focus>
23    fn Focus(&self, cx: &mut JSContext) -> Rc<Promise> {
24        // TODO: Implement
25        Promise::new2(cx, &self.global())
26    }
27
28    /// <https://w3c.github.io/ServiceWorker/#dom-windowclient-navigate>
29    fn Navigate(&self, cx: &mut JSContext, _url: USVString) -> Rc<Promise> {
30        // TODO: Implement
31        Promise::new2(cx, &self.global())
32    }
33}