mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
~[] to Vec in net/resource_task.rs
This commit is contained in:
parent
631f70b1c5
commit
c174a40afd
2 changed files with 3 additions and 3 deletions
|
@ -96,12 +96,12 @@ pub fn start_sending(start_chan: Sender<LoadResponse>,
|
||||||
|
|
||||||
/// Convenience function for synchronously loading a whole resource.
|
/// Convenience function for synchronously loading a whole resource.
|
||||||
pub fn load_whole_resource(resource_task: &ResourceTask, url: Url)
|
pub fn load_whole_resource(resource_task: &ResourceTask, url: Url)
|
||||||
-> Result<(Metadata, ~[u8]), ()> {
|
-> Result<(Metadata, Vec<u8>), ()> {
|
||||||
let (start_chan, start_port) = channel();
|
let (start_chan, start_port) = channel();
|
||||||
resource_task.send(Load(url, start_chan));
|
resource_task.send(Load(url, start_chan));
|
||||||
let response = start_port.recv();
|
let response = start_port.recv();
|
||||||
|
|
||||||
let mut buf = ~[];
|
let mut buf = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
match response.progress_port.recv() {
|
match response.progress_port.recv() {
|
||||||
Payload(data) => buf.push_all(data.as_slice()),
|
Payload(data) => buf.push_all(data.as_slice()),
|
||||||
|
|
|
@ -140,7 +140,7 @@ fn js_script_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
||||||
}
|
}
|
||||||
Ok((metadata, bytes)) => {
|
Ok((metadata, bytes)) => {
|
||||||
result_vec.push(JSFile {
|
result_vec.push(JSFile {
|
||||||
data: str::from_utf8(bytes).unwrap().to_owned(),
|
data: str::from_utf8(bytes.as_slice()).unwrap().to_owned(),
|
||||||
url: metadata.final_url,
|
url: metadata.final_url,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue