Index: Source/core/dom/DOMImplementation.cpp |
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp |
index ac17ccb749655871ed4312d8d64dc5efab282290..03be1f060801a1ad1d1c868f34a76154f64adc91 100644 |
--- a/Source/core/dom/DOMImplementation.cpp |
+++ b/Source/core/dom/DOMImplementation.cpp |
@@ -233,24 +233,31 @@ PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&, |
return sheet; |
} |
+static bool equalToUpperCaseASCIIIgnoringCase(char asciiUpper, UChar u) |
+{ |
+ return static_cast<UChar>(asciiUpper) == (u & static_cast<UChar>(~0x20)); |
jochen (gone - plz use gerrit)
2014/01/03 11:31:09
nit. use toASCIIUpper()
|
+} |
+ |
bool DOMImplementation::isXMLMIMEType(const String& mimeType) |
{ |
- if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl") |
+ if (equalIgnoringCase(mimeType, "text/xml") |
+ || equalIgnoringCase(mimeType, "application/xml") |
+ || equalIgnoringCase(mimeType, "text/xsl")) |
return true; |
- // Per RFCs 3023 and 2045 a mime type is of the form: |
+ // Per RFCs 3023 and 2045, an XML MIME type is of the form: |
// ^[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]+/[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]+\+xml$ |
int length = mimeType.length(); |
if (length < 7) |
return false; |
- if (mimeType[0] == '/' || |
- mimeType[length - 5] == '/' || |
- mimeType[length - 4] != '+' || |
- mimeType[length - 3] != 'x' || |
- mimeType[length - 2] != 'm' || |
- mimeType[length - 1] != 'l') |
+ if (mimeType[0] == '/' |
+ || mimeType[length - 5] == '/' |
+ || mimeType[length - 4] != '+' |
+ || !equalToUpperCaseASCIIIgnoringCase('X', mimeType[length - 3]) |
jochen (gone - plz use gerrit)
2014/01/03 11:31:09
why not !mimeType.endsWith("+xml", true)
sof
2014/01/03 13:51:02
Nice; switched to this simpler form instead (remov
|
+ || !equalToUpperCaseASCIIIgnoringCase('M', mimeType[length - 2]) |
+ || !equalToUpperCaseASCIIIgnoringCase('L', mimeType[length - 1])) |
return false; |
bool hasSlash = false; |