From f8ae394cadb28958e52ae941bc3a89f4ea7fb4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 11 Jun 2019 11:53:46 +0200 Subject: [PATCH] Remove extra hash-map lookup unregistering media controls --- components/script/dom/document.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index fea12fc6905..20f29de2f42 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -2475,7 +2475,8 @@ impl Document { } pub fn unregister_media_controls(&self, id: &str) { - if let Some(media_controls) = self.media_controls.borrow().get(id) { + if let Some(ref media_controls) = self.media_controls.borrow_mut().remove(id) { + let media_controls = DomRoot::from_ref(&**media_controls); media_controls.Host().detach_shadow(); media_controls .upcast::() @@ -2483,7 +2484,6 @@ impl Document { } else { debug_assert!(false, "Trying to unregister unknown media controls"); } - self.media_controls.borrow_mut().remove(id); } }