"javascript:" urls: remove unnecessary block

Remove this block and unindent the code one level.

Doing this required cloning `load_data.url` so that we could
later mutate `load_data.url` in the same block.
This commit is contained in:
Daniel Johnson 2017-09-07 17:03:41 -07:00
parent 6ae6031468
commit 709cd3a0b6

View file

@ -2334,7 +2334,6 @@ impl ScriptThread {
} }
pub fn eval_js_url(global_scope: &GlobalScope, load_data: &mut LoadData) { pub fn eval_js_url(global_scope: &GlobalScope, load_data: &mut LoadData) {
{
// Turn javascript: URL into JS code to eval, according to the steps in // Turn javascript: URL into JS code to eval, according to the steps in
// https://html.spec.whatwg.org/multipage/#javascript-protocol // https://html.spec.whatwg.org/multipage/#javascript-protocol
@ -2342,7 +2341,7 @@ impl ScriptThread {
// Start with the scheme data of the parsed URL; // Start with the scheme data of the parsed URL;
// append question mark and query component, if any; // append question mark and query component, if any;
// append number sign and fragment component if any. // append number sign and fragment component if any.
let encoded = &load_data.url[Position::BeforePath..]; let encoded = &load_data.url.clone()[Position::BeforePath..];
// Percent-decode (8.) and UTF-8 decode (9.) // Percent-decode (8.) and UTF-8 decode (9.)
let script_source = percent_decode(encoded.as_bytes()).decode_utf8_lossy(); let script_source = percent_decode(encoded.as_bytes()).decode_utf8_lossy();
@ -2367,7 +2366,6 @@ impl ScriptThread {
} else { } else {
Some(JsEvalResult::NoContent) Some(JsEvalResult::NoContent)
}; };
};
load_data.url = ServoUrl::parse("about:blank").unwrap(); load_data.url = ServoUrl::parse("about:blank").unwrap();
} }