aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-30 16:48:30 +0100
committerMs2ger <Ms2ger@gmail.com>2015-10-30 16:48:30 +0100
commit48c232f72b966ef3561249987caa26b22bc367d2 (patch)
treea79739dea9cdf2eb35d67da654183cfb10467a54 /components
parente8914cd82929e0a82b7288df7d84b4125d9212e0 (diff)
downloadservo-48c232f72b966ef3561249987caa26b22bc367d2.tar.gz
servo-48c232f72b966ef3561249987caa26b22bc367d2.zip
Remove the pointless TextEncoder::encoding field.
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/textencoder.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs
index 913b7c4fe86..e6aa9a3d747 100644
--- a/components/script/dom/textencoder.rs
+++ b/components/script/dom/textencoder.rs
@@ -22,22 +22,20 @@ use util::str::DOMString;
#[dom_struct]
pub struct TextEncoder {
reflector_: Reflector,
- encoding: DOMString,
#[ignore_heap_size_of = "Defined in rust-encoding"]
encoder: EncodingRef,
}
impl TextEncoder {
- fn new_inherited(encoding: DOMString, encoder: EncodingRef) -> TextEncoder {
+ fn new_inherited(encoder: EncodingRef) -> TextEncoder {
TextEncoder {
reflector_: Reflector::new(),
- encoding: encoding,
encoder: encoder,
}
}
- pub fn new(global: GlobalRef, encoding: DOMString, encoder: EncodingRef) -> Root<TextEncoder> {
- reflect_dom_object(box TextEncoder::new_inherited(encoding, encoder),
+ pub fn new(global: GlobalRef, encoder: EncodingRef) -> Root<TextEncoder> {
+ reflect_dom_object(box TextEncoder::new_inherited(encoder),
global,
TextEncoderBinding::Wrap)
}
@@ -55,7 +53,7 @@ impl TextEncoder {
match encoding.name() {
"utf-8" | "utf-16be" | "utf-16le" => {
- Ok(TextEncoder::new(global, encoding.name().to_owned(), encoding))
+ Ok(TextEncoder::new(global, encoding))
}
_ => {
debug!("Encoding Not UTF");
@@ -68,7 +66,7 @@ impl TextEncoder {
impl TextEncoderMethods for TextEncoder {
// https://encoding.spec.whatwg.org/#dom-textencoder-encoding
fn Encoding(&self) -> DOMString {
- self.encoding.clone()
+ self.encoder.name().to_owned()
}
#[allow(unsafe_code)]