mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
Library changes
This commit is contained in:
parent
ffe60ea027
commit
be061a9aa0
45 changed files with 167 additions and 183 deletions
|
@ -2,11 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use extra::net::url;
|
||||
use extra::net::url::Url;
|
||||
use extra::url;
|
||||
use extra::url::Url;
|
||||
use std::hashmap::HashMap;
|
||||
use std::os;
|
||||
use std::result;
|
||||
|
||||
/**
|
||||
Create a URL object from a string. Does various helpful browsery things like
|
||||
|
@ -19,7 +18,7 @@ Create a URL object from a string. Does various helpful browsery things like
|
|||
*/
|
||||
pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
||||
let schm = url::get_scheme(str_url);
|
||||
let str_url = if result::is_err(&schm) {
|
||||
let str_url = if schm.is_err() {
|
||||
if current_url.is_none() {
|
||||
// Assume we've been given a file path. If it's absolute just return
|
||||
// it, otherwise make it absolute with the cwd.
|
||||
|
@ -29,7 +28,7 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
|||
~"file://" + os::getcwd().push(str_url).to_str()
|
||||
}
|
||||
} else {
|
||||
let current_url = current_url.get();
|
||||
let current_url = current_url.unwrap();
|
||||
debug!("make_url: current_url: %?", current_url);
|
||||
if str_url.starts_with("//") {
|
||||
current_url.scheme + ":" + str_url
|
||||
|
@ -56,7 +55,7 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
|||
};
|
||||
|
||||
// FIXME: Need to handle errors
|
||||
url::from_str(str_url).get()
|
||||
url::from_str(str_url).unwrap()
|
||||
}
|
||||
|
||||
mod make_url_tests {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue