aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/serviceworker.rs
diff options
context:
space:
mode:
authorGregory Terzian <gterzian@users.noreply.github.com>2020-04-25 16:01:28 +0800
committerGregory Terzian <gterzian@users.noreply.github.com>2020-05-21 13:21:21 +0800
commit89eb7c2aa2a949ac851ea33382af3c54efdcbc17 (patch)
tree00604f6a90e1e6a230892a4d2b191c0c92c9e0b5 /components/script/dom/serviceworker.rs
parent7e74f733016f2d384791fddcf0c5071cbce3e7cb (diff)
downloadservo-89eb7c2aa2a949ac851ea33382af3c54efdcbc17.tar.gz
servo-89eb7c2aa2a949ac851ea33382af3c54efdcbc17.zip
serviceworker: make job queue unique per origin
Diffstat (limited to 'components/script/dom/serviceworker.rs')
-rw-r--r--components/script/dom/serviceworker.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs
index fce07ab0809..bcbdd158a40 100644
--- a/components/script/dom/serviceworker.rs
+++ b/components/script/dom/serviceworker.rs
@@ -23,6 +23,7 @@ use crate::task::TaskOnce;
use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject};
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
+use msg::constellation_msg::ServiceWorkerId;
use script_traits::{DOMMessage, ScriptMsg};
use servo_url::ServoUrl;
use std::cell::Cell;
@@ -35,31 +36,35 @@ pub struct ServiceWorker {
script_url: DomRefCell<String>,
scope_url: ServoUrl,
state: Cell<ServiceWorkerState>,
- skip_waiting: Cell<bool>,
+ worker_id: ServiceWorkerId,
}
impl ServiceWorker {
- fn new_inherited(script_url: &str, skip_waiting: bool, scope_url: ServoUrl) -> ServiceWorker {
+ fn new_inherited(
+ script_url: &str,
+ scope_url: ServoUrl,
+ worker_id: ServiceWorkerId,
+ ) -> ServiceWorker {
ServiceWorker {
eventtarget: EventTarget::new_inherited(),
script_url: DomRefCell::new(String::from(script_url)),
state: Cell::new(ServiceWorkerState::Installing),
scope_url: scope_url,
- skip_waiting: Cell::new(skip_waiting),
+ worker_id,
}
}
- pub fn install_serviceworker(
+ pub fn new(
global: &GlobalScope,
script_url: ServoUrl,
scope_url: ServoUrl,
- skip_waiting: bool,
+ worker_id: ServiceWorkerId,
) -> DomRoot<ServiceWorker> {
reflect_dom_object(
Box::new(ServiceWorker::new_inherited(
script_url.as_str(),
- skip_waiting,
scope_url,
+ worker_id,
)),
global,
)