diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-16 15:11:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 15:11:25 -0500 |
commit | fa77675488d4be64a4dfe015ac314db7ec1eb005 (patch) | |
tree | 52634d8c3001f174a1ebd99731ecfa987692b190 /components/script | |
parent | 369983211da48f6e8c2d54792b8d34192582f7bc (diff) | |
parent | 72ffbb7a27f3aa48e78f99bcea0f743dfa17fb6f (diff) | |
download | servo-fa77675488d4be64a4dfe015ac314db7ec1eb005.tar.gz servo-fa77675488d4be64a4dfe015ac314db7ec1eb005.zip |
Auto merge of #22171 - CYBAI:sw-up-to-date, r=jdm
Update webidl of ServiceWorkerRegistration
I'll start to work on #19302 and I'd like to update these sw related webidl one by one.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes is part of #19302
- [x] These changes do not require tests because it just updates the webidl for `ServiceWorkerRegistration`; related tests should be updated when we start to implement its functions.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22171)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/serviceworkerregistration.rs | 9 | ||||
-rw-r--r-- | components/script/dom/webidls/ServiceWorkerRegistration.webidl | 18 |
2 files changed, 22 insertions, 5 deletions
diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 3b1ca4fdab0..bd4f1dd03b9 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState; +use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::ServiceWorkerUpdateViaCache; use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ ServiceWorkerRegistrationMethods, Wrap, }; @@ -25,6 +26,7 @@ pub struct ServiceWorkerRegistration { installing: Option<Dom<ServiceWorker>>, waiting: Option<Dom<ServiceWorker>>, scope: ServoUrl, + update_via_cache: ServiceWorkerUpdateViaCache, uninstalling: Cell<bool>, } @@ -36,9 +38,11 @@ impl ServiceWorkerRegistration { installing: None, waiting: None, scope: scope, + update_via_cache: ServiceWorkerUpdateViaCache::Imports, uninstalling: Cell::new(false), } } + #[allow(unrooted_must_root)] pub fn new( global: &GlobalScope, @@ -138,4 +142,9 @@ impl ServiceWorkerRegistrationMethods for ServiceWorkerRegistration { fn Scope(&self) -> USVString { USVString(self.scope.as_str().to_owned()) } + + // https://w3c.github.io/ServiceWorker/#service-worker-registration-updateviacache + fn UpdateViaCache(&self) -> ServiceWorkerUpdateViaCache { + self.update_via_cache + } } diff --git a/components/script/dom/webidls/ServiceWorkerRegistration.webidl b/components/script/dom/webidls/ServiceWorkerRegistration.webidl index 27c27d7cc41..f8ea37337c5 100644 --- a/components/script/dom/webidls/ServiceWorkerRegistration.webidl +++ b/components/script/dom/webidls/ServiceWorkerRegistration.webidl @@ -2,14 +2,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// https://w3c.github.io/ServiceWorker/#service-worker-registration-obj -[Pref="dom.serviceworker.enabled", Exposed=(Window,Worker)] +// https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface +[Pref="dom.serviceworker.enabled", SecureContext, Exposed=(Window,Worker)] interface ServiceWorkerRegistration : EventTarget { - [Unforgeable] readonly attribute ServiceWorker? installing; - [Unforgeable] readonly attribute ServiceWorker? waiting; - [Unforgeable] readonly attribute ServiceWorker? active; + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; + // [SameObject] readonly attribute NavigationPreloadManager navigationPreload; readonly attribute USVString scope; + readonly attribute ServiceWorkerUpdateViaCache updateViaCache; // [NewObject] Promise<void> update(); // [NewObject] Promise<boolean> unregister(); @@ -17,3 +19,9 @@ interface ServiceWorkerRegistration : EventTarget { // event // attribute EventHandler onupdatefound; }; + +enum ServiceWorkerUpdateViaCache { + "imports", + "all", + "none" +}; |