Index: Source/WebCore/dom/DOMImplementation.cpp |
=================================================================== |
--- Source/WebCore/dom/DOMImplementation.cpp (revision 97019) |
+++ Source/WebCore/dom/DOMImplementation.cpp (working copy) |
@@ -48,6 +48,7 @@ |
#include "RegularExpression.h" |
#include "Settings.h" |
#include "TextDocument.h" |
+#include "ThreadGlobalData.h" |
#include "XMLNames.h" |
#include <wtf/StdLibExtras.h> |
@@ -272,13 +273,27 @@ |
return sheet.release(); |
} |
+static const char* const validXMLMIMETypeChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045 |
+ |
+XMLMIMETypeRegExp::XMLMIMETypeRegExp() : |
+ m_regex(adoptPtr(new RegularExpression(WTF::makeString("^", validXMLMIMETypeChars, "+/", validXMLMIMETypeChars, "+\\+xml$"), TextCaseSensitive))) |
+{ |
+} |
+ |
+XMLMIMETypeRegExp::~XMLMIMETypeRegExp() |
+{ |
+} |
+ |
+bool XMLMIMETypeRegExp::isXMLMIMEType(const String& mimeType) |
+{ |
+ return m_regex->match(mimeType) > -1; |
+} |
+ |
bool DOMImplementation::isXMLMIMEType(const String& mimeType) |
{ |
if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl") |
return true; |
- static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045 |
- DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$", TextCaseSensitive)); |
- return xmlTypeRegExp.match(mimeType) > -1; |
+ return threadGlobalData().xmlTypeRegExp().isXMLMIMEType(mimeType); |
} |
bool DOMImplementation::isTextMIMEType(const String& mimeType) |