зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1428745 - Remove support for version parameter from script loader - trimming script type, r=jonco
This commit is contained in:
Родитель
174498ca29
Коммит
606217325c
|
@ -171,9 +171,20 @@ HTMLScriptElement::SetText(const nsAString& aValue, ErrorResult& aRv)
|
|||
// need to be transfered when modifying
|
||||
|
||||
bool
|
||||
HTMLScriptElement::GetScriptType(nsAString& type)
|
||||
HTMLScriptElement::GetScriptType(nsAString& aType)
|
||||
{
|
||||
return GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
nsAutoString type;
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ASCII whitespace https://infra.spec.whatwg.org/#ascii-whitespace:
|
||||
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
|
||||
static const char kASCIIWhitespace[] = "\t\n\f\r ";
|
||||
type.Trim(kASCIIWhitespace);
|
||||
|
||||
aType.Assign(type);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -4,3 +4,4 @@ support-files =
|
|||
|
||||
[test_bug1053321.html]
|
||||
skip-if = os == 'android' # bug 1386644
|
||||
[test_whitespace.html]
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for ScriptLoader and type with whitespaces</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
let passed = false;
|
||||
|
||||
let tests = [
|
||||
[ " application/javascript", true ],
|
||||
[ "\tapplication/javascript\n\r \t", true ],
|
||||
];
|
||||
|
||||
for (let i = 0; i < tests.length; ++i) {
|
||||
passed = false;
|
||||
|
||||
let script = document.createElement('script');
|
||||
script.setAttribute('type', tests[i][0]);
|
||||
script.innerText = "passed = true;";
|
||||
document.body.appendChild(script);
|
||||
|
||||
ok (passed, tests[i][1], "Test " + tests[i][0] + " passed");
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче