mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Create the root frame before evaluating the javascript URL.
This prevents a crash when the script in the javascript URL accesses the document attribute.
This commit is contained in:
parent
2d0e96e133
commit
10e39161f7
1 changed files with 9 additions and 9 deletions
|
@ -733,15 +733,6 @@ impl ScriptTask {
|
||||||
|
|
||||||
self.compositor.borrow_mut().set_ready_state(pipeline_id, Loading);
|
self.compositor.borrow_mut().set_ready_state(pipeline_id, Loading);
|
||||||
|
|
||||||
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()))
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Create the root frame.
|
// Create the root frame.
|
||||||
let mut frame = page.mut_frame();
|
let mut frame = page.mut_frame();
|
||||||
|
@ -751,6 +742,15 @@ 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()))
|
||||||
|
};
|
||||||
|
|
||||||
parse_html(&*page, *document, parser_input, self.resource_task.clone(), Some(load_data));
|
parse_html(&*page, *document, parser_input, self.resource_task.clone(), Some(load_data));
|
||||||
url = page.get_url().clone();
|
url = page.get_url().clone();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue