diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-02 06:18:59 -0500 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-02 06:18:59 -0500 |
commit | cc017fc0b8619726f0c82649f41fdcf5595b19e4 (patch) | |
tree | e77fdc04eef71792a28898da24eb564f48432fe5 /components/script/dom/navigator.rs | |
parent | 196adaff07201deb273077213fa63c460cc11629 (diff) | |
parent | 15a2064c0d7b468724b43d1cb6157d506ad19093 (diff) | |
download | servo-cc017fc0b8619726f0c82649f41fdcf5595b19e4.tar.gz servo-cc017fc0b8619726f0c82649f41fdcf5595b19e4.zip |
Auto merge of #11114 - creativcoder:nav-sw, r=jdm
implement related service worker interface and register method
Fixes #11091
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11114)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/navigator.rs')
-rw-r--r-- | components/script/dom/navigator.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 8a17b2dbc17..75bd2c13c23 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -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())) + } } |