mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Introduce GlobalScope::get_url
This commit is contained in:
parent
092504b4e3
commit
f38159b7d3
10 changed files with 39 additions and 39 deletions
|
@ -32,7 +32,6 @@ use std::ffi::CString;
|
|||
use std::panic;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
||||
use url::Url;
|
||||
|
||||
/// A freely-copyable reference to a rooted global object.
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -91,14 +90,6 @@ impl<'a> GlobalRef<'a> {
|
|||
self.resource_threads().sender()
|
||||
}
|
||||
|
||||
/// Get the URL for this global scope.
|
||||
pub fn get_url(&self) -> Url {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.get_url(),
|
||||
GlobalRef::Worker(ref worker) => worker.get_url().clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// `ScriptChan` used to send messages to the event loop of this global's
|
||||
/// thread.
|
||||
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
|
||||
|
@ -158,7 +149,7 @@ impl<'a> GlobalRef<'a> {
|
|||
&self, code: &str, filename: &str, rval: MutableHandleValue) {
|
||||
let metadata = time::TimerMetadata {
|
||||
url: if filename.is_empty() {
|
||||
self.get_url().as_str().into()
|
||||
self.as_global_scope().get_url().as_str().into()
|
||||
} else {
|
||||
filename.into()
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue