Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: Source/WebCore/dom/DOMImplementation.cpp

Issue 8210003: Merge 96999 - Make isXMLMIMEType regex use TLS (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/dom/DOMImplementation.h ('k') | Source/WebCore/platform/ThreadGlobalData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/WebCore/dom/DOMImplementation.h ('k') | Source/WebCore/platform/ThreadGlobalData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698