TextEncoder::Constructor should not trim whitespaces or lowercase labels #5900

Fixes #5900
This commit is contained in:
Prabhjyot Singh Sodhi 2015-04-30 14:54:01 +05:30
parent 2c17779440
commit 1d0976c192
2 changed files with 1 additions and 220 deletions

View file

@ -14,7 +14,6 @@ use dom::bindings::utils::{Reflector, reflect_dom_object};
use util::str::DOMString;
use std::borrow::ToOwned;
use std::ascii::AsciiExt;
use std::ptr;
use encoding::types::EncodingRef;
@ -50,7 +49,7 @@ impl TextEncoder {
// https://encoding.spec.whatwg.org/#dom-textencoder
pub fn Constructor(global: GlobalRef,
label: DOMString) -> Fallible<Temporary<TextEncoder>> {
let encoding = match encoding_from_whatwg_label(&label.trim().to_ascii_lowercase()) {
let encoding = match encoding_from_whatwg_label(&label) {
Some(enc) => enc,
None => {
debug!("Encoding Label Not Supported");