diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-11-28 18:27:23 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-12-23 11:15:46 +0100 |
commit | ec5d08c88730ac707368de03528744677a75231d (patch) | |
tree | 0548c655e1493f90a4f0c3d74587d6d70d42ae3a /components/script/script_thread.rs | |
parent | 01e336f6912292b5ca4c7349846a5d100974d99e (diff) | |
download | servo-ec5d08c88730ac707368de03528744677a75231d.tar.gz servo-ec5d08c88730ac707368de03528744677a75231d.zip |
Pass the Document's origin to its constructor.
CC #10963.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 538ce0b5f8c..130c9787a6d 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -77,6 +77,7 @@ use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCach use net_traits::request::{CredentialsMode, Destination, RequestInit}; use net_traits::storage_thread::StorageType; use network_listener::NetworkListener; +use origin::Origin; use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_layout_interface::message::{self, NewLayoutThreadInfo, ReflowQueryType}; @@ -152,6 +153,7 @@ struct InProgressLoad { is_visible: bool, /// The requested URL of the load. url: ServoUrl, + origin: Origin, } impl InProgressLoad { @@ -161,7 +163,8 @@ impl InProgressLoad { parent_info: Option<(PipelineId, FrameType)>, layout_chan: Sender<message::Msg>, window_size: Option<WindowSizeData>, - url: ServoUrl) -> InProgressLoad { + url: ServoUrl, + origin: Origin) -> InProgressLoad { InProgressLoad { pipeline_id: id, frame_id: frame_id, @@ -172,6 +175,7 @@ impl InProgressLoad { is_frozen: false, is_visible: true, url: url, + origin: origin, } } } @@ -540,8 +544,9 @@ impl ScriptThreadFactory for ScriptThread { let mut failsafe = ScriptMemoryFailsafe::new(&script_thread); + let origin = Origin::new(&load_data.url); let new_load = InProgressLoad::new(id, frame_id, parent_info, layout_chan, window_size, - load_data.url.clone()); + load_data.url.clone(), origin); script_thread.start_page_load(new_load, load_data); let reporter_name = format!("script-reporter-{}", id); @@ -605,12 +610,12 @@ impl ScriptThread { }); } - pub fn process_attach_layout(new_layout_info: NewLayoutInfo) { + pub fn process_attach_layout(new_layout_info: NewLayoutInfo, origin: Origin) { SCRIPT_THREAD_ROOT.with(|root| { if let Some(script_thread) = root.get() { let script_thread = unsafe { &*script_thread }; script_thread.profile_event(ScriptThreadEventCategory::AttachLayout, || { - script_thread.handle_new_layout(new_layout_info); + script_thread.handle_new_layout(new_layout_info, origin); }) } }); @@ -783,7 +788,8 @@ impl ScriptThread { FromConstellation(ConstellationControlMsg::AttachLayout( new_layout_info)) => { self.profile_event(ScriptThreadEventCategory::AttachLayout, || { - self.handle_new_layout(new_layout_info); + let origin = Origin::new(&new_layout_info.load_data.url); + self.handle_new_layout(new_layout_info, origin); }) } FromConstellation(ConstellationControlMsg::Resize(id, size, size_type)) => { @@ -1194,7 +1200,7 @@ impl ScriptThread { window.set_scroll_offsets(scroll_offsets) } - fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) { + fn handle_new_layout(&self, new_layout_info: NewLayoutInfo, origin: Origin) { let NewLayoutInfo { parent_info, new_pipeline_id, @@ -1236,7 +1242,7 @@ impl ScriptThread { // Kick off the fetch for the new resource. let new_load = InProgressLoad::new(new_pipeline_id, frame_id, parent_info, layout_chan, window_size, - load_data.url.clone()); + load_data.url.clone(), origin); if load_data.url.as_str() == "about:blank" { self.start_page_load_about_blank(new_load); } else { @@ -1808,6 +1814,7 @@ impl ScriptThread { let document = Document::new(&window, Some(&browsing_context), Some(final_url.clone()), + incomplete.origin, is_html_document, content_type, last_modified, |