Lower case the type attribute before checking if it's JS

This commit is contained in:
Claes 'Letharion' Gyllensvärd 2014-11-17 18:49:22 +01:00
parent 64cc9ec688
commit d84c0fc52a
2 changed files with 4 additions and 88 deletions

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ascii::AsciiExt;
use dom::attr::Attr; use dom::attr::Attr;
use dom::attr::AttrHelpers; use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
@ -216,7 +218,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
}, },
Some(ref s) => { Some(ref s) => {
debug!("script type={:s}", *s); debug!("script type={:s}", *s);
SCRIPT_JS_MIMES.contains(&s.as_slice().trim_chars(HTML_SPACE_CHARACTERS)) SCRIPT_JS_MIMES.contains(&s.to_ascii_lower().as_slice().trim_chars(HTML_SPACE_CHARACTERS))
}, },
None => { None => {
debug!("no script type"); debug!("no script type");
@ -229,7 +231,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
}, },
Some(ref s) => { Some(ref s) => {
debug!("script language={:s}", *s); debug!("script language={:s}", *s);
SCRIPT_JS_MIMES.contains(&format!("text/{}", s).as_slice()) SCRIPT_JS_MIMES.contains(&format!("text/{}", s).to_ascii_lower().as_slice())
}, },
None => { None => {
debug!("no script type or language, inferring js"); debug!("no script type or language, inferring js");

View file

@ -1,86 +0,0 @@
[script-languages-02.html]
type: testharness
[Script should run with type="APPLICATION/ECMASCRIPT"]
expected: FAIL
[Script should run with type="APPLICATION/JAVASCRIPT"]
expected: FAIL
[Script should run with type="APPLICATION/X-ECMASCRIPT"]
expected: FAIL
[Script should run with type="APPLICATION/X-JAVASCRIPT"]
expected: FAIL
[Script should run with type="TEXT/ECMASCRIPT"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.0"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.1"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.2"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.3"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.4"]
expected: FAIL
[Script should run with type="TEXT/JAVASCRIPT1.5"]
expected: FAIL
[Script should run with type="TEXT/JSCRIPT"]
expected: FAIL
[Script should run with type="TEXT/LIVESCRIPT"]
expected: FAIL
[Script should run with type="TEXT/X-ECMASCRIPT"]
expected: FAIL
[Script should run with type="TEXT/X-JAVASCRIPT"]
expected: FAIL
[Script should run with language="ECMASCRIPT"]
expected: FAIL
[Script should run with language="JAVASCRIPT"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.0"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.1"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.2"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.3"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.4"]
expected: FAIL
[Script should run with language="JAVASCRIPT1.5"]
expected: FAIL
[Script should run with language="JSCRIPT"]
expected: FAIL
[Script should run with language="LIVESCRIPT"]
expected: FAIL
[Script should run with language="X-ECMASCRIPT"]
expected: FAIL
[Script should run with language="X-JAVASCRIPT"]
expected: FAIL