Skip to main content

script/dom/serviceworker/
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 dom_struct::dom_struct;
6use js::context::JSContext;
7use script_bindings::codegen::GenericBindings::WindowClientBinding::WindowClientMethods;
8use script_bindings::str::USVString;
9
10use crate::dom::bindings::reflector::DomGlobal;
11use crate::dom::client::Client;
12use crate::dom::promise::{Promise, RootedPromise};
13
14#[dom_struct]
15pub(crate) struct WindowClient {
16    client: Client,
17}
18
19impl WindowClientMethods<crate::DomTypeHolder> for WindowClient {
20    /// <https://w3c.github.io/ServiceWorker/#dom-windowclient-focus>
21    fn Focus(&self, cx: &mut JSContext) -> RootedPromise {
22        // TODO: Implement
23        Promise::new(cx, &self.global())
24    }
25
26    /// <https://w3c.github.io/ServiceWorker/#dom-windowclient-navigate>
27    fn Navigate(&self, cx: &mut JSContext, _url: USVString) -> RootedPromise {
28        // TODO: Implement
29        Promise::new(cx, &self.global())
30    }
31}