mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
added origin to globalscope
This commit is contained in:
parent
3af69cf9bf
commit
2c6bd51bef
8 changed files with 44 additions and 8 deletions
|
@ -38,7 +38,7 @@ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
|||
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
|
||||
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEvent};
|
||||
use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
|
||||
use servo_url::ServoUrl;
|
||||
use servo_url::{MutableOrigin, ServoUrl};
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
@ -92,6 +92,9 @@ pub struct GlobalScope {
|
|||
resource_threads: ResourceThreads,
|
||||
|
||||
timers: OneshotTimers,
|
||||
|
||||
/// The origin of the globalscope
|
||||
origin: MutableOrigin,
|
||||
}
|
||||
|
||||
impl GlobalScope {
|
||||
|
@ -103,7 +106,8 @@ impl GlobalScope {
|
|||
constellation_chan: IpcSender<ConstellationMsg>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
resource_threads: ResourceThreads,
|
||||
timer_event_chan: IpcSender<TimerEvent>)
|
||||
timer_event_chan: IpcSender<TimerEvent>,
|
||||
origin: MutableOrigin)
|
||||
-> Self {
|
||||
GlobalScope {
|
||||
eventtarget: EventTarget::new_inherited(),
|
||||
|
@ -120,6 +124,7 @@ impl GlobalScope {
|
|||
in_error_reporting_mode: Default::default(),
|
||||
resource_threads: resource_threads,
|
||||
timers: OneshotTimers::new(timer_event_chan, scheduler_chan),
|
||||
origin: origin,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,6 +243,11 @@ impl GlobalScope {
|
|||
self.pipeline_id
|
||||
}
|
||||
|
||||
/// Get the origin for this global scope
|
||||
pub fn origin(&self) -> &MutableOrigin {
|
||||
&self.origin
|
||||
}
|
||||
|
||||
/// Get the [base url](https://html.spec.whatwg.org/multipage/#api-base-url)
|
||||
/// for this global scope.
|
||||
pub fn api_base_url(&self) -> ServoUrl {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue