mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Remove unsound Root::deref() calls in HTML elements.
This commit is contained in:
parent
6032a2f8af
commit
d09d245ee1
5 changed files with 8 additions and 3 deletions
|
@ -112,6 +112,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
|||
|
||||
// Subpage Id
|
||||
let window = window_from_node(self).root();
|
||||
let window = window.r();
|
||||
let page = window.page();
|
||||
let subpage_id = page.get_next_subpage_id();
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ impl<'a> PrivateHTMLImageElementHelpers for JSRef<'a, HTMLImageElement> {
|
|||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
let document = node.owner_doc().root();
|
||||
let window = document.r().window().root();
|
||||
let window = window.r();
|
||||
let image_cache = window.image_cache_task();
|
||||
match value {
|
||||
None => {
|
||||
|
|
|
@ -127,7 +127,8 @@ trait PrivateHTMLLinkElementHelpers {
|
|||
impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
|
||||
fn handle_stylesheet_url(self, href: &str) {
|
||||
let window = window_from_node(self).root();
|
||||
match UrlParser::new().base_url(&window.r().page().get_url()).parse(href) {
|
||||
let window = window.r();
|
||||
match UrlParser::new().base_url(&window.page().get_url()).parse(href) {
|
||||
Ok(url) => {
|
||||
let LayoutChan(ref layout_chan) = window.page().layout_chan;
|
||||
layout_chan.send(Msg::LoadStylesheet(url));
|
||||
|
|
|
@ -170,6 +170,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
|||
// TODO: Add support for the `defer` and `async` attributes. (For now, we fetch all
|
||||
// scripts synchronously and execute them immediately.)
|
||||
let window = window_from_node(self).root();
|
||||
let window = window.r();
|
||||
let page = window.page();
|
||||
let base_url = page.get_url();
|
||||
|
||||
|
@ -207,9 +208,9 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
|||
None => (text, base_url)
|
||||
};
|
||||
|
||||
window.r().evaluate_script_with_result(source.as_slice(), url.serialize().as_slice());
|
||||
window.evaluate_script_with_result(source.as_slice(), url.serialize().as_slice());
|
||||
|
||||
let event = Event::new(GlobalRef::Window(window.r()),
|
||||
let event = Event::new(GlobalRef::Window(window),
|
||||
"load".into_string(),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable).root();
|
||||
|
|
|
@ -51,6 +51,7 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
|
|||
assert!(node.is_in_doc());
|
||||
|
||||
let win = window_from_node(node).root();
|
||||
let win = win.r();
|
||||
let url = win.page().get_url();
|
||||
|
||||
let data = node.GetTextContent().expect("Element.textContent must be a string");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue