mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +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 {
|
let (parser_input, base_url, load_response) = 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) => {
|
|
||||||
// Wait for the LoadResponse so that the parser knows the final URL.
|
// Wait for the LoadResponse so that the parser knows the final URL.
|
||||||
let (input_chan, input_port) = channel();
|
let (input_chan, input_port) = channel();
|
||||||
self.resource_task.send(Load(NetLoadData {
|
self.resource_task.send(Load(NetLoadData {
|
||||||
|
@ -783,11 +773,12 @@ impl ScriptTask {
|
||||||
*page.mut_url() = Some((base_url.clone(), true));
|
*page.mut_url() = Some((base_url.clone(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
(base_url, Some(load_response))
|
(InputUrl(url.clone()), base_url, Some(load_response))
|
||||||
},
|
} else {
|
||||||
InputString(_) => {
|
let evalstr = load_data.url.non_relative_scheme_data().unwrap();
|
||||||
(doc_url, None)
|
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);
|
parse_html(*document, parser_input, base_url, load_response);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue