mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
implement related sw interface and register method
This commit is contained in:
parent
0594d58bc8
commit
15a2064c0d
33 changed files with 1285 additions and 217 deletions
|
@ -12,6 +12,7 @@ use dom::bluetooth::Bluetooth;
|
|||
use dom::mimetypearray::MimeTypeArray;
|
||||
use dom::navigatorinfo;
|
||||
use dom::pluginarray::PluginArray;
|
||||
use dom::serviceworkercontainer::ServiceWorkerContainer;
|
||||
use dom::window::Window;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -20,6 +21,7 @@ pub struct Navigator {
|
|||
bluetooth: MutNullableHeap<JS<Bluetooth>>,
|
||||
plugins: MutNullableHeap<JS<PluginArray>>,
|
||||
mime_types: MutNullableHeap<JS<MimeTypeArray>>,
|
||||
serviceWorker: MutNullableHeap<JS<ServiceWorkerContainer>>,
|
||||
}
|
||||
|
||||
impl Navigator {
|
||||
|
@ -29,6 +31,7 @@ impl Navigator {
|
|||
bluetooth: Default::default(),
|
||||
plugins: Default::default(),
|
||||
mime_types: Default::default(),
|
||||
serviceWorker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,4 +102,9 @@ impl NavigatorMethods for Navigator {
|
|||
fn JavaEnabled(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#navigator-service-worker-attribute
|
||||
fn ServiceWorker(&self) -> Root<ServiceWorkerContainer> {
|
||||
self.serviceWorker.or_init(|| ServiceWorkerContainer::new(self.global().r()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue