aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-02-22 09:46:27 -0800
committerGitHub <noreply@github.com>2017-02-22 09:46:27 -0800
commit78e8c31a4d1890260dda83f2db85672f693c1e97 (patch)
treed31e1478eeced21a5a53b714c3ba75b04e91c5c1 /components/script/script_thread.rs
parent2bfea912dccd5e76e062143f3d48d2a66118fc59 (diff)
parentbfd7b950ad1d2e9264563fc40d5684a96bbab23f (diff)
downloadservo-78e8c31a4d1890260dda83f2db85672f693c1e97.tar.gz
servo-78e8c31a4d1890260dda83f2db85672f693c1e97.zip
Auto merge of #15438 - asajeffrey:url-serializable-origin, r=jdm
Add ImmutableOrigin to allow for serializing origins <!-- Please describe your changes on the following line: --> This PR adds a serializable type `ImmutableOrigin` and a non-serializable type `MutableOrigin`. The immutable type represents an origin with `null` domain, and the mutable type represents an origin with a mutable domain. This separation is needed for implementing setting `document.domain`. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14892. - [X] These changes do not require tests because it's a refactoring which will enable other features. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15438) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index ac093a7a5df..2ab421c707b 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -77,7 +77,6 @@ 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};
@@ -95,7 +94,7 @@ use script_traits::WebVREventMsg;
use script_traits::webdriver_msg::WebDriverScriptCommand;
use serviceworkerjob::{Job, JobQueue, AsyncJobHandler};
use servo_config::opts;
-use servo_url::ServoUrl;
+use servo_url::{MutableOrigin, ServoUrl};
use std::cell::Cell;
use std::collections::{hash_map, HashMap, HashSet};
use std::default::Default;
@@ -155,7 +154,8 @@ struct InProgressLoad {
is_visible: bool,
/// The requested URL of the load.
url: ServoUrl,
- origin: Origin,
+ /// The origin for the document
+ origin: MutableOrigin,
}
impl InProgressLoad {
@@ -166,7 +166,7 @@ impl InProgressLoad {
layout_chan: Sender<message::Msg>,
window_size: Option<WindowSizeData>,
url: ServoUrl,
- origin: Origin) -> InProgressLoad {
+ origin: MutableOrigin) -> InProgressLoad {
InProgressLoad {
pipeline_id: id,
frame_id: frame_id,
@@ -545,7 +545,7 @@ impl ScriptThreadFactory for ScriptThread {
let mut failsafe = ScriptMemoryFailsafe::new(&script_thread);
- let origin = Origin::new(&load_data.url);
+ let origin = MutableOrigin::new(load_data.url.origin());
let new_load = InProgressLoad::new(id, frame_id, parent_info, layout_chan, window_size,
load_data.url.clone(), origin);
script_thread.start_page_load(new_load, load_data);
@@ -611,7 +611,7 @@ impl ScriptThread {
});
}
- pub fn process_attach_layout(new_layout_info: NewLayoutInfo, origin: Origin) {
+ pub fn process_attach_layout(new_layout_info: NewLayoutInfo, origin: MutableOrigin) {
SCRIPT_THREAD_ROOT.with(|root| {
if let Some(script_thread) = root.get() {
let script_thread = unsafe { &*script_thread };
@@ -791,7 +791,7 @@ impl ScriptThread {
FromConstellation(ConstellationControlMsg::AttachLayout(
new_layout_info)) => {
self.profile_event(ScriptThreadEventCategory::AttachLayout, || {
- let origin = Origin::new(&new_layout_info.load_data.url);
+ let origin = MutableOrigin::new(new_layout_info.load_data.url.origin());
self.handle_new_layout(new_layout_info, origin);
})
}
@@ -1208,7 +1208,7 @@ impl ScriptThread {
window.set_scroll_offsets(scroll_offsets)
}
- fn handle_new_layout(&self, new_layout_info: NewLayoutInfo, origin: Origin) {
+ fn handle_new_layout(&self, new_layout_info: NewLayoutInfo, origin: MutableOrigin) {
let NewLayoutInfo {
parent_info,
new_pipeline_id,