| Index: Source/core/xml/DOMParser.cpp
|
| diff --git a/Source/core/xml/DOMParser.cpp b/Source/core/xml/DOMParser.cpp
|
| index 25c1cb6d6d222de8bcb4086409d31592094b2c63..29a37da443b3d171f6b20c38ceecac077c9f6e62 100644
|
| --- a/Source/core/xml/DOMParser.cpp
|
| +++ b/Source/core/xml/DOMParser.cpp
|
| @@ -20,14 +20,23 @@
|
| #include "core/xml/DOMParser.h"
|
|
|
| #include "core/dom/DOMImplementation.h"
|
| +#include "core/dom/ExceptionCode.h"
|
| #include "wtf/text/WTFString.h"
|
|
|
| namespace WebCore {
|
|
|
| -PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& contentType)
|
| +PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& contentType, ExceptionState& es)
|
| {
|
| - if (!DOMImplementation::isXMLMIMEType(contentType) && contentType != "text/html")
|
| + // HTML5 is very explicit about which types we're allowed to support here:
|
| + // http://domparsing.spec.whatwg.org/#the-domparser-interface
|
| + if (contentType != "text/html"
|
| + && contentType != "text/xml"
|
| + && contentType != "application/xml"
|
| + && contentType != "application/xhtml+xml"
|
| + && contentType != "image/svg+xml") {
|
| + es.throwDOMException(TypeError, "Unsupported mime-type specified.");
|
| return 0;
|
| + }
|
|
|
| RefPtr<Document> doc = DOMImplementation::createDocument(contentType, 0, KURL(), false);
|
| doc->setContent(str);
|
|
|