Add ImmutableOrigin to allow for serializing origins

This commit is contained in:
Connor Brewster 2017-01-20 13:21:23 -06:00 committed by Alan Jeffrey
parent 4f7e422054
commit bfd7b950ad
21 changed files with 270 additions and 152 deletions

View file

@ -62,7 +62,6 @@ use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::storage_thread::StorageType;
use num_traits::ToPrimitive;
use open;
use origin::Origin;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
@ -83,7 +82,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::ServoUrl;
use servo_url::{ImmutableOrigin, ServoUrl};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
@ -660,10 +659,10 @@ impl WindowMethods for Window {
"/" => {
// TODO(#12715): Should be the origin of the incumbent settings
// object, not self's.
Some(self.Document().origin().copy())
Some(self.Document().origin().immutable().clone())
},
url => match ServoUrl::parse(&url) {
Ok(url) => Some(Origin::new(&url)),
Ok(url) => Some(url.origin().clone()),
Err(_) => return Err(Error::Syntax),
}
};
@ -1793,13 +1792,13 @@ fn debug_reflow_events(id: PipelineId, goal: &ReflowGoal, query_type: &ReflowQue
struct PostMessageHandler {
destination: Trusted<Window>,
origin: Option<Origin>,
origin: Option<ImmutableOrigin>,
message: StructuredCloneData,
}
impl PostMessageHandler {
fn new(window: &Window,
origin: Option<Origin>,
origin: Option<ImmutableOrigin>,
message: StructuredCloneData) -> PostMessageHandler {
PostMessageHandler {
destination: Trusted::new(window),