From f1f53468a072365fe9dae72422afe428d813e794 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 18 Mar 2016 16:38:17 +0100 Subject: [PATCH] Use a Cell for HTMLScriptElement::block_character_encoding. --- components/script/dom/htmlscriptelement.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index eaafcadd7cc..eb63d524c9c 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -70,7 +70,7 @@ pub struct HTMLScriptElement { #[ignore_heap_size_of = "Defined in rust-encoding"] /// https://html.spec.whatwg.org/multipage/#concept-script-encoding - block_character_encoding: DOMRefCell>, + block_character_encoding: Cell>, } impl HTMLScriptElement { @@ -85,7 +85,7 @@ impl HTMLScriptElement { ready_to_be_parser_executed: Cell::new(false), parser_document: JS::from_ref(document), load: DOMRefCell::new(None), - block_character_encoding: DOMRefCell::new(None), + block_character_encoding: Cell::new(None), } } @@ -247,7 +247,7 @@ impl HTMLScriptElement { // Step 13. if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) { if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) { - *self.block_character_encoding.borrow_mut() = Some(encodingRef); + self.block_character_encoding.set(Some(encodingRef)); } } @@ -394,7 +394,7 @@ impl HTMLScriptElement { let encoding = metadata.charset .and_then(|encoding| encoding_from_whatwg_label(&encoding)) - .or_else(|| *self.block_character_encoding.borrow()) + .or_else(|| self.block_character_encoding.get()) .unwrap_or_else(|| self.parser_document.encoding()); (DOMString::from(encoding.decode(&*bytes, DecoderTrap::Replace).unwrap()),