Skip to content

Commit 915a63b

Browse files
author
bors-servo
authored
Auto merge of #14246 - emilio:servo-url, r=<try>
WIP: Urlmageddon <!-- Please describe your changes on the following line: --> Still needs a bunch of code in net to be converted in order to get more advantage of this for images and stuff, but meanwhile this should help quite a bit with #13778. Still wanted to get this in. r? @SimonSapin <!-- 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/14246) <!-- Reviewable:end -->
2 parents f14e733 + 4401845 commit 915a63b

File tree

155 files changed

+1025
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+1025
-704
lines changed

components/compositing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ profile_traits = {path = "../profile_traits"}
2323
script_traits = {path = "../script_traits"}
2424
serde = "0.8"
2525
serde_derive = "0.8"
26+
servo_url = {path = "../url", features = ["servo"]}
2627
style_traits = {path = "../style_traits"}
2728
time = "0.1.17"
28-
url = {version = "1.2", features = ["heap_size"]}
2929
util = {path = "../util"}
3030

3131
[dependencies.webrender]

components/compositing/compositor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton};
2626
use script_traits::{MouseEventType, StackingContextScrollState};
2727
use script_traits::{TouchpadPressurePhase, TouchEventType, TouchId, WindowSizeData, WindowSizeType};
2828
use script_traits::CompositorEvent::{self, MouseMoveEvent, MouseButtonEvent, TouchEvent, TouchpadPressureEvent};
29+
use servo_url::ServoUrl;
2930
use std::collections::HashMap;
3031
use std::fs::File;
3132
use std::rc::Rc;
@@ -34,7 +35,6 @@ use style_traits::{PagePx, ViewportPx};
3435
use style_traits::viewport::ViewportConstraints;
3536
use time::{precise_time_ns, precise_time_s};
3637
use touch::{TouchHandler, TouchAction};
37-
use url::Url;
3838
use util::geometry::ScreenPx;
3939
use util::opts;
4040
use util::prefs::PREFS;
@@ -697,7 +697,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
697697
}
698698
}
699699

700-
fn change_page_url(&mut self, _: PipelineId, url: Url) {
700+
fn change_page_url(&mut self, _: PipelineId, url: ServoUrl) {
701701
self.window.set_page_url(url);
702702
}
703703

@@ -881,7 +881,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
881881
fn on_load_url_window_event(&mut self, url_string: String) {
882882
debug!("osmain: loading URL `{}`", url_string);
883883
self.got_load_complete_message = false;
884-
match Url::parse(&url_string) {
884+
match ServoUrl::parse(&url_string) {
885885
Ok(url) => {
886886
self.window.set_page_url(url.clone());
887887
let msg = match self.root_pipeline {

components/compositing/compositor_thread.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use net_traits::image::base::Image;
1414
use profile_traits::mem;
1515
use profile_traits::time;
1616
use script_traits::{AnimationState, ConstellationMsg, EventResult};
17+
use servo_url::ServoUrl;
1718
use std::fmt::{Debug, Error, Formatter};
1819
use std::sync::mpsc::{Receiver, Sender};
1920
use style_traits::cursor::Cursor;
2021
use style_traits::viewport::ViewportConstraints;
21-
use url::Url;
2222
use webrender;
2323
use webrender_traits;
2424

@@ -76,7 +76,7 @@ pub enum Msg {
7676
/// Alerts the compositor that the current page has changed its title.
7777
ChangePageTitle(PipelineId, Option<String>),
7878
/// Alerts the compositor that the current page has changed its URL.
79-
ChangePageUrl(PipelineId, Url),
79+
ChangePageUrl(PipelineId, ServoUrl),
8080
/// Alerts the compositor that the given pipeline has changed whether it is running animations.
8181
ChangeRunningAnimationsState(PipelineId, AnimationState),
8282
/// Replaces the current frame tree, typically called during main frame navigation.
@@ -102,7 +102,7 @@ pub enum Msg {
102102
/// A reply to the compositor asking if the output image is stable.
103103
IsReadyToSaveImageReply(bool),
104104
/// A favicon was detected
105-
NewFavicon(Url),
105+
NewFavicon(ServoUrl),
106106
/// <head> tag finished parsing
107107
HeadParsed,
108108
/// A status message to be displayed by the browser chrome.

components/compositing/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ extern crate profile_traits;
2323
extern crate script_traits;
2424
#[macro_use]
2525
extern crate serde_derive;
26+
extern crate servo_url;
2627
extern crate style_traits;
2728
extern crate time;
28-
extern crate url;
2929
#[macro_use]
3030
extern crate util;
3131
extern crate webrender;

components/compositing/windowing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use gfx_traits::DevicePixel;
1313
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
1414
use net_traits::net_error_list::NetError;
1515
use script_traits::{MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
16+
use servo_url::ServoUrl;
1617
use std::fmt::{Debug, Error, Formatter};
1718
use style_traits::cursor::Cursor;
18-
use url::Url;
1919
use util::geometry::ScreenPx;
2020

2121
#[derive(Clone)]
@@ -123,7 +123,7 @@ pub trait WindowMethods {
123123
/// Sets the page title for the current page.
124124
fn set_page_title(&self, title: Option<String>);
125125
/// Sets the load data for the current page.
126-
fn set_page_url(&self, url: Url);
126+
fn set_page_url(&self, url: ServoUrl);
127127
/// Called when the browser chrome should display a status message.
128128
fn status(&self, Option<String>);
129129
/// Called when the browser has started loading a frame.
@@ -160,5 +160,5 @@ pub trait WindowMethods {
160160
fn supports_clipboard(&self) -> bool;
161161

162162
/// Add a favicon
163-
fn set_favicon(&self, url: Url);
163+
fn set_favicon(&self, url: ServoUrl);
164164
}

components/constellation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ script_traits = {path = "../script_traits"}
3333
serde = "0.8"
3434
serde_derive = "0.8"
3535
style_traits = {path = "../style_traits"}
36-
url = {version = "1.2", features = ["heap_size"]}
36+
servo_url = {path = "../url", features = ["servo"]}
3737
util = {path = "../util"}
3838

3939
[dependencies.webrender_traits]

components/constellation/constellation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, Scri
4646
use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg};
4747
use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData};
4848
use script_traits::{SWManagerMsg, ScopeThings, WindowSizeType};
49+
use servo_url::ServoUrl;
4950
use std::borrow::ToOwned;
5051
use std::collections::{HashMap, VecDeque};
5152
use std::io::Error as IOError;
@@ -62,7 +63,6 @@ use style_traits::PagePx;
6263
use style_traits::cursor::Cursor;
6364
use style_traits::viewport::ViewportConstraints;
6465
use timer_scheduler::TimerScheduler;
65-
use url::Url;
6666
use util::opts;
6767
use util::prefs::PREFS;
6868
use util::remutex::ReentrantMutex;
@@ -1047,15 +1047,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
10471047
}
10481048
}
10491049

1050-
fn handle_register_serviceworker(&self, scope_things: ScopeThings, scope: Url) {
1050+
fn handle_register_serviceworker(&self, scope_things: ScopeThings, scope: ServoUrl) {
10511051
if let Some(ref mgr) = self.swmanager_chan {
10521052
let _ = mgr.send(ServiceWorkerMsg::RegisterServiceWorker(scope_things, scope));
10531053
} else {
10541054
warn!("sending scope info to service worker manager failed");
10551055
}
10561056
}
10571057

1058-
fn handle_broadcast_storage_event(&self, pipeline_id: PipelineId, storage: StorageType, url: Url,
1058+
fn handle_broadcast_storage_event(&self, pipeline_id: PipelineId, storage: StorageType, url: ServoUrl,
10591059
key: Option<String>, old_value: Option<String>, new_value: Option<String>) {
10601060
let origin = url.origin();
10611061
for pipeline in self.pipelines.values() {
@@ -1204,7 +1204,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
12041204
self.close_pipeline(pending_pipeline_id, ExitPipelineMode::Force);
12051205
}
12061206

1207-
let failure_url = Url::parse("about:failure").expect("infallible");
1207+
let failure_url = ServoUrl::parse("about:failure").expect("infallible");
12081208

12091209
if let Some(pipeline_url) = pipeline_url {
12101210
if pipeline_url == failure_url {
@@ -1245,7 +1245,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
12451245
}
12461246
}
12471247

1248-
fn handle_init_load(&mut self, url: Url) {
1248+
fn handle_init_load(&mut self, url: ServoUrl) {
12491249
let window_size = self.window_size.visible_viewport;
12501250
let root_pipeline_id = PipelineId::new();
12511251
let root_frame_id = self.root_frame_id;
@@ -1331,7 +1331,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
13311331
let load_data = load_info.load_data.unwrap_or_else(|| {
13321332
let url = match old_pipeline {
13331333
Some(old_pipeline) => old_pipeline.url.clone(),
1334-
None => Url::parse("about:blank").expect("infallible"),
1334+
None => ServoUrl::parse("about:blank").expect("infallible"),
13351335
};
13361336

13371337
// TODO - loaddata here should have referrer info (not None, None)

components/constellation/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ extern crate script_traits;
3636
extern crate serde;
3737
#[macro_use]
3838
extern crate serde_derive;
39+
extern crate servo_url;
3940
extern crate style_traits;
40-
extern crate url;
4141
#[macro_use]
4242
extern crate util;
4343
extern crate webrender_traits;

components/constellation/pipeline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use script_traits::{ConstellationControlMsg, InitialScriptState};
2626
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
2727
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
2828
use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData};
29+
use servo_url::ServoUrl;
2930
use std::collections::HashMap;
3031
use std::env;
3132
use std::ffi::OsStr;
@@ -34,7 +35,6 @@ use std::process;
3435
use std::rc::Rc;
3536
use std::sync::mpsc::Sender;
3637
use style_traits::{PagePx, ViewportPx};
37-
use url::Url;
3838
use util::opts::{self, Opts};
3939
use util::prefs::{PREFS, Pref};
4040
use webrender_traits;
@@ -58,7 +58,7 @@ pub struct Pipeline {
5858
/// A channel to the compositor.
5959
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
6060
/// URL corresponding to the most recently-loaded page.
61-
pub url: Url,
61+
pub url: ServoUrl,
6262
/// The title of the most recently-loaded page.
6363
pub title: Option<String>,
6464
pub size: Option<TypedSize2D<f32, PagePx>>,
@@ -264,7 +264,7 @@ impl Pipeline {
264264
layout_chan: IpcSender<LayoutControlMsg>,
265265
compositor_proxy: Box<CompositorProxy + 'static + Send>,
266266
is_private: bool,
267-
url: Url,
267+
url: ServoUrl,
268268
size: Option<TypedSize2D<f32, PagePx>>,
269269
visible: bool)
270270
-> Pipeline {

components/devtools_traits/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ ipc-channel = "0.5"
1919
msg = {path = "../msg"}
2020
serde = "0.8"
2121
serde_derive = "0.8"
22+
servo_url = {path = "../url"}
2223
time = "0.1"
23-
url = {version = "1.2", features = ["heap_size"]}

0 commit comments

Comments
 (0)