diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 861271abe43..8e1c09c2361 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -4655,6 +4655,11 @@ impl StyleSheetListOwner for Dom { /// Remove a stylesheet owned by `owner` from the list of document sheets. #[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily. fn remove_stylesheet(&self, owner: &Element, s: &Arc) { + self.window + .layout_chan() + .send(Msg::RemoveStylesheet(s.clone())) + .unwrap(); + self.document_or_shadow_root.remove_stylesheet( owner, s, diff --git a/components/script/dom/documentorshadowroot.rs b/components/script/dom/documentorshadowroot.rs index 51846baa443..27d52e086c6 100644 --- a/components/script/dom/documentorshadowroot.rs +++ b/components/script/dom/documentorshadowroot.rs @@ -13,7 +13,7 @@ use crate::dom::node; use crate::dom::window::Window; use euclid::Point2D; use js::jsapi::JS_GetRuntime; -use script_layout_interface::message::{Msg, NodesFromPointQueryType, QueryMsg}; +use script_layout_interface::message::{NodesFromPointQueryType, QueryMsg}; use script_traits::UntrustedNodeAddress; use servo_arc::Arc; use std::fmt; @@ -216,11 +216,6 @@ impl DocumentOrShadowRoot { s: &Arc, stylesheets: &mut StylesheetSet, ) { - self.window - .layout_chan() - .send(Msg::RemoveStylesheet(s.clone())) - .unwrap(); - let guard = s.shared_lock.read(); // FIXME(emilio): Would be nice to remove the clone, etc.