added origin to globalscope

This commit is contained in:
ddh 2017-04-21 18:30:06 +01:00
parent 3af69cf9bf
commit 2c6bd51bef
8 changed files with 44 additions and 8 deletions

View file

@ -85,7 +85,7 @@ use servo_atoms::Atom;
use servo_config::opts;
use servo_config::prefs::PREFS;
use servo_geometry::{f32_rect_to_au_rect, max_rect};
use servo_url::{Host, ImmutableOrigin, ServoUrl};
use servo_url::{Host, MutableOrigin, ImmutableOrigin, ServoUrl};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
@ -286,6 +286,10 @@ impl Window {
}
}
pub fn origin(&self) -> &MutableOrigin {
self.globalscope.origin()
}
pub fn get_cx(&self) -> *mut JSContext {
self.js_runtime.borrow().as_ref().unwrap().cx()
}
@ -1749,6 +1753,7 @@ impl Window {
id: PipelineId,
parent_info: Option<(PipelineId, FrameType)>,
window_size: Option<WindowSizeData>,
origin: MutableOrigin,
webvr_thread: Option<IpcSender<WebVRMsg>>)
-> Root<Window> {
let layout_rpc: Box<LayoutRPC + Send> = {
@ -1771,7 +1776,8 @@ impl Window {
constellation_chan,
scheduler_chan,
resource_threads,
timer_event_chan),
timer_event_chan,
origin),
script_chan: script_chan,
dom_manipulation_task_source: dom_task_source,
user_interaction_task_source: user_task_source,