Urlmageddon: Use refcounted urls more often.

This commit is contained in:
Emilio Cobos Álvarez 2016-11-16 11:57:39 +01:00
parent f14e7339b5
commit 913c874cb5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
161 changed files with 1044 additions and 718 deletions

View file

@ -76,6 +76,7 @@ use script_traits::{DocumentState, TimerEvent, TimerEventId};
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, WindowSizeData, WindowSizeType};
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
@ -102,7 +103,6 @@ use time;
use timers::{IsInterval, TimerCallback};
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
use tinyfiledialogs::{self, MessageBoxIcon};
use url::Url;
use util::geometry::{self, max_rect};
use util::opts;
use util::prefs::PREFS;
@ -624,7 +624,7 @@ impl WindowMethods for Window {
// object, not self's.
Some(self.Document().origin().copy())
},
url => match Url::parse(&url) {
url => match ServoUrl::parse(&url) {
Ok(url) => Some(Origin::new(&url)),
Err(_) => return Err(Error::Syntax),
}
@ -860,7 +860,7 @@ impl WindowMethods for Window {
// check-tidy: no specs after this line
fn OpenURLInDefaultBrowser(&self, href: DOMString) -> ErrorResult {
let url = try!(Url::parse(&href).map_err(|e| {
let url = try!(ServoUrl::parse(&href).map_err(|e| {
Error::Type(format!("Couldn't parse URL: {}", e))
}));
match open::that(url.as_str()) {
@ -1322,7 +1322,7 @@ impl Window {
}
/// Commence a new URL load which will either replace this window or scroll to a fragment.
pub fn load_url(&self, url: Url, replace: bool, referrer_policy: Option<ReferrerPolicy>) {
pub fn load_url(&self, url: ServoUrl, replace: bool, referrer_policy: Option<ReferrerPolicy>) {
let doc = self.Document();
let referrer_policy = referrer_policy.or(doc.get_referrer_policy());
@ -1355,7 +1355,7 @@ impl Window {
self.window_size.get()
}
pub fn get_url(&self) -> Url {
pub fn get_url(&self) -> ServoUrl {
(*self.Document().url()).clone()
}