mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use a Cell for HTMLScriptElement::block_character_encoding.
This commit is contained in:
parent
89b8499df8
commit
f1f53468a0
1 changed files with 4 additions and 4 deletions
|
@ -70,7 +70,7 @@ pub struct HTMLScriptElement {
|
||||||
|
|
||||||
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-script-encoding
|
/// https://html.spec.whatwg.org/multipage/#concept-script-encoding
|
||||||
block_character_encoding: DOMRefCell<Option<EncodingRef>>,
|
block_character_encoding: Cell<Option<EncodingRef>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLScriptElement {
|
impl HTMLScriptElement {
|
||||||
|
@ -85,7 +85,7 @@ impl HTMLScriptElement {
|
||||||
ready_to_be_parser_executed: Cell::new(false),
|
ready_to_be_parser_executed: Cell::new(false),
|
||||||
parser_document: JS::from_ref(document),
|
parser_document: JS::from_ref(document),
|
||||||
load: DOMRefCell::new(None),
|
load: DOMRefCell::new(None),
|
||||||
block_character_encoding: DOMRefCell::new(None),
|
block_character_encoding: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ impl HTMLScriptElement {
|
||||||
// Step 13.
|
// Step 13.
|
||||||
if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) {
|
if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) {
|
||||||
if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) {
|
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
|
let encoding = metadata.charset
|
||||||
.and_then(|encoding| encoding_from_whatwg_label(&encoding))
|
.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());
|
.unwrap_or_else(|| self.parser_document.encoding());
|
||||||
|
|
||||||
(DOMString::from(encoding.decode(&*bytes, DecoderTrap::Replace).unwrap()),
|
(DOMString::from(encoding.decode(&*bytes, DecoderTrap::Replace).unwrap()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue