mirror of
https://github.com/servo/servo.git
synced 2025-06-14 03:14:29 +00:00
Update webidl of ServiceWorkerRegistration
This commit is contained in:
parent
19b4f35de1
commit
72ffbb7a27
2 changed files with 22 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* 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::ServiceWorkerBinding::ServiceWorkerState;
|
||||||
|
use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::ServiceWorkerUpdateViaCache;
|
||||||
use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{
|
use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{
|
||||||
ServiceWorkerRegistrationMethods, Wrap,
|
ServiceWorkerRegistrationMethods, Wrap,
|
||||||
};
|
};
|
||||||
|
@ -25,6 +26,7 @@ pub struct ServiceWorkerRegistration {
|
||||||
installing: Option<Dom<ServiceWorker>>,
|
installing: Option<Dom<ServiceWorker>>,
|
||||||
waiting: Option<Dom<ServiceWorker>>,
|
waiting: Option<Dom<ServiceWorker>>,
|
||||||
scope: ServoUrl,
|
scope: ServoUrl,
|
||||||
|
update_via_cache: ServiceWorkerUpdateViaCache,
|
||||||
uninstalling: Cell<bool>,
|
uninstalling: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +38,11 @@ impl ServiceWorkerRegistration {
|
||||||
installing: None,
|
installing: None,
|
||||||
waiting: None,
|
waiting: None,
|
||||||
scope: scope,
|
scope: scope,
|
||||||
|
update_via_cache: ServiceWorkerUpdateViaCache::Imports,
|
||||||
uninstalling: Cell::new(false),
|
uninstalling: Cell::new(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
@ -138,4 +142,9 @@ impl ServiceWorkerRegistrationMethods for ServiceWorkerRegistration {
|
||||||
fn Scope(&self) -> USVString {
|
fn Scope(&self) -> USVString {
|
||||||
USVString(self.scope.as_str().to_owned())
|
USVString(self.scope.as_str().to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/ServiceWorker/#service-worker-registration-updateviacache
|
||||||
|
fn UpdateViaCache(&self) -> ServiceWorkerUpdateViaCache {
|
||||||
|
self.update_via_cache
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://w3c.github.io/ServiceWorker/#service-worker-registration-obj
|
// https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface
|
||||||
[Pref="dom.serviceworker.enabled", Exposed=(Window,Worker)]
|
[Pref="dom.serviceworker.enabled", SecureContext, Exposed=(Window,Worker)]
|
||||||
interface ServiceWorkerRegistration : EventTarget {
|
interface ServiceWorkerRegistration : EventTarget {
|
||||||
[Unforgeable] readonly attribute ServiceWorker? installing;
|
readonly attribute ServiceWorker? installing;
|
||||||
[Unforgeable] readonly attribute ServiceWorker? waiting;
|
readonly attribute ServiceWorker? waiting;
|
||||||
[Unforgeable] readonly attribute ServiceWorker? active;
|
readonly attribute ServiceWorker? active;
|
||||||
|
// [SameObject] readonly attribute NavigationPreloadManager navigationPreload;
|
||||||
|
|
||||||
readonly attribute USVString scope;
|
readonly attribute USVString scope;
|
||||||
|
readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
|
||||||
|
|
||||||
// [NewObject] Promise<void> update();
|
// [NewObject] Promise<void> update();
|
||||||
// [NewObject] Promise<boolean> unregister();
|
// [NewObject] Promise<boolean> unregister();
|
||||||
|
@ -17,3 +19,9 @@ interface ServiceWorkerRegistration : EventTarget {
|
||||||
// event
|
// event
|
||||||
// attribute EventHandler onupdatefound;
|
// attribute EventHandler onupdatefound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ServiceWorkerUpdateViaCache {
|
||||||
|
"imports",
|
||||||
|
"all",
|
||||||
|
"none"
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue