Introduce GlobalScope::get_url

This commit is contained in:
Anthony Ramine 2016-10-02 14:29:01 +02:00
parent 092504b4e3
commit f38159b7d3
10 changed files with 39 additions and 39 deletions

View file

@ -179,6 +179,17 @@ impl GlobalScope {
}
unreachable!();
}
/// Get the URL for this global scope.
pub fn get_url(&self) -> Url {
if let Some(window) = self.downcast::<Window>() {
return window.get_url();
}
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
return worker.get_url().clone();
}
unreachable!();
}
}
fn timestamp_in_ms(time: Timespec) -> u64 {