Make service workers talk to their serviceworkerglobalscopes

This commit is contained in:
Rahul Sharma 2016-07-28 23:34:44 +05:30
parent 72279cc7eb
commit 0996b38ade
13 changed files with 184 additions and 46 deletions

View file

@ -6,10 +6,11 @@ use dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState;
use dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::USVString;
use dom::eventtarget::EventTarget;
use dom::serviceworker::ServiceWorker;
use dom::serviceworker::{ServiceWorker, TrustedServiceWorkerAddress};
use dom::serviceworkercontainer::Controllable;
use dom::workerglobalscope::prepare_workerscope_init;
use script_traits::{WorkerScriptLoadOrigin, ScopeThings};
@ -49,6 +50,10 @@ impl ServiceWorkerRegistration {
self.active.as_ref().unwrap()
}
pub fn get_trusted_worker(&self) -> TrustedServiceWorkerAddress {
Trusted::new(self.active.as_ref().unwrap())
}
pub fn create_scope_things(global: GlobalRef, script_url: Url) -> ScopeThings {
let worker_load_origin = WorkerScriptLoadOrigin {
referrer_url: None,