Bug 1428745 - Remove support for version parameter from script loader - trimming script type, r=jonco

This commit is contained in:
Andrea Marchesini
2018-01-09 17:00:50 +01:00
parent a8d2ddc57e
commit 287c4cc0ed
3 changed files with 45 additions and 2 deletions

View File

@@ -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