mirror of
https://github.com/servo/servo.git
synced 2025-07-26 00:30:22 +01:00
Combine two conditionals in ScriptTask::load.
Now that the code lives in the same function, I see no reason for them to remain separate.
This commit is contained in:
parent
9f08d563ae
commit
fbedf030d4
1 changed files with 31 additions and 40 deletions
|
@ -744,17 +744,7 @@ impl ScriptTask {
|
|||
});
|
||||
}
|
||||
|
||||
let parser_input = if !is_javascript {
|
||||
InputUrl(url.clone())
|
||||
} else {
|
||||
let evalstr = load_data.url.non_relative_scheme_data().unwrap();
|
||||
let jsval = window.evaluate_js_with_result(evalstr);
|
||||
let strval = FromJSValConvertible::from_jsval(self.get_cx(), jsval, Empty);
|
||||
InputString(strval.unwrap_or("".to_string()))
|
||||
};
|
||||
|
||||
let (base_url, load_response) = match parser_input {
|
||||
InputUrl(ref url) => {
|
||||
let (parser_input, base_url, load_response) = if !is_javascript {
|
||||
// Wait for the LoadResponse so that the parser knows the final URL.
|
||||
let (input_chan, input_port) = channel();
|
||||
self.resource_task.send(Load(NetLoadData {
|
||||
|
@ -783,11 +773,12 @@ impl ScriptTask {
|
|||
*page.mut_url() = Some((base_url.clone(), true));
|
||||
}
|
||||
|
||||
(base_url, Some(load_response))
|
||||
},
|
||||
InputString(_) => {
|
||||
(doc_url, None)
|
||||
},
|
||||
(InputUrl(url.clone()), base_url, Some(load_response))
|
||||
} else {
|
||||
let evalstr = load_data.url.non_relative_scheme_data().unwrap();
|
||||
let jsval = window.evaluate_js_with_result(evalstr);
|
||||
let strval = FromJSValConvertible::from_jsval(self.get_cx(), jsval, Empty);
|
||||
(InputString(strval.unwrap_or("".to_string())), doc_url, None)
|
||||
};
|
||||
|
||||
parse_html(*document, parser_input, base_url, load_response);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue