mirror of
https://github.com/servo/servo.git
synced 2025-06-18 05:14:28 +00:00
Resolve relative URLs that begin with '//'
This commit is contained in:
parent
a9ed2d809d
commit
e50cee9adc
3 changed files with 7 additions and 2 deletions
|
@ -43,6 +43,7 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance,
|
||||||
fn data_stream(provenance: StylesheetProvenance, resource_task: ResourceTask) -> DataStream {
|
fn data_stream(provenance: StylesheetProvenance, resource_task: ResourceTask) -> DataStream {
|
||||||
match provenance {
|
match provenance {
|
||||||
UrlProvenance(url) => {
|
UrlProvenance(url) => {
|
||||||
|
debug!("cssparse: loading style sheet at %s", url.to_str());
|
||||||
let (input_port, input_chan) = comm::stream();
|
let (input_port, input_chan) = comm::stream();
|
||||||
resource_task.send(Load(url, input_chan));
|
resource_task.send(Load(url, input_chan));
|
||||||
resource_port_to_data_stream(input_port)
|
resource_port_to_data_stream(input_port)
|
||||||
|
|
|
@ -129,11 +129,13 @@ fn js_script_listener(to_parent: Chan<~[~[u8]]>,
|
||||||
buf += data;
|
buf += data;
|
||||||
}
|
}
|
||||||
Done(Ok(*)) => {
|
Done(Ok(*)) => {
|
||||||
result_chan.send(buf);
|
result_chan.send(Some(buf));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Done(Err(*)) => {
|
Done(Err(*)) => {
|
||||||
error!("error loading script %s", url.to_str());
|
error!("error loading script %s", url.to_str());
|
||||||
|
result_chan.send(None);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +148,7 @@ fn js_script_listener(to_parent: Chan<~[~[u8]]>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let js_scripts = vec::map(result_vec, |result_port| result_port.recv());
|
let js_scripts = vec::filter_map(result_vec, |result_port| result_port.recv());
|
||||||
to_parent.send(js_scripts);
|
to_parent.send(js_scripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
||||||
debug!("make_url: current_url: %?", current_url);
|
debug!("make_url: current_url: %?", current_url);
|
||||||
if current_url.path.is_empty() || current_url.path.ends_with("/") {
|
if current_url.path.is_empty() || current_url.path.ends_with("/") {
|
||||||
current_url.scheme + "://" + current_url.host + "/" + str_url
|
current_url.scheme + "://" + current_url.host + "/" + str_url
|
||||||
|
} else if str_url.starts_with("//") {
|
||||||
|
current_url.scheme + ":" + str_url
|
||||||
} else {
|
} else {
|
||||||
let mut path = ~[];
|
let mut path = ~[];
|
||||||
for str::each_split_char(current_url.path, '/') |p| {
|
for str::each_split_char(current_url.path, '/') |p| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue