+2006-04-28 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by andersca.
+
+ WebKit should accept */*+xml as XML.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=5998
+
+ * http/tests/xmlhttprequest/supported-xml-content-types-expected.txt: Added.
+ * http/tests/xmlhttprequest/supported-xml-content-types.cgi: Added.
+ * http/tests/xmlhttprequest/supported-xml-content-types.html: Added.
+
2006-04-27 Geoffrey Garen <ggaren@apple.com>
- Updated to remove diff shmutz:
--- /dev/null
+PASS -- testing: text/xml -- responseXML: [object Document]
+
+PASS -- testing: image/svg+xml -- responseXML: [object Document]
+
+PASS -- testing: application/soap+xml -- responseXML: [object Document]
+
+PASS -- testing: foo/bar+xml -- responseXML: [object Document]
+
+PASS -- testing: 123/BAR+xml -- responseXML: [object Document]
+
+PASS -- testing: foo_bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo-bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo+bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo~bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo!bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo$bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo^bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo{bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo}bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo|bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo%bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo'bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo`bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo#bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo&bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo*bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: text/html -- responseXML: undefined
+
+PASS -- testing: image/png -- responseXML: undefined
+
+PASS -- testing: invalid -- responseXML: undefined
+
+FAIL (got document -- response type: foo bar/baz+xml) -- testing: foo bar/baz+xml -- responseXML: [object Document]
+
+PASS -- testing: foo[bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo]bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo(bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo)bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo
+
+PASS -- testing: foo>bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo@bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo,bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo;bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo:bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo\bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo"bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo/bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo?bar/baz+xml -- responseXML: undefined
+
+PASS -- testing: foo=bar/baz+xml -- responseXML: undefined
+
+
--- /dev/null
+#!/usr/bin/perl -w
+
+use CGI qw(:standard);
+my $cgi = new CGI;
+my $type = $cgi->param('type');
+$type =~ s/\^\^PLUS\^\^/+/g;
+
+my $escapedType = $type;
+$escapedType =~ s/&/&/;
+$escapedType =~ s/</</;
+$escapedType =~ s/>/>/;
+$escapedType =~ s/'/'/;
+$escapedType =~ s/"/"/;
+
+print "Content-type: $type\n\n";
+print "<type>$escapedType</type>\n";
--- /dev/null
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var request = new XMLHttpRequest();
+
+function getXMLOfType(type)
+{
+ var escapedType = escape(type).replace(/\+/g, "^^PLUS^^"); // Perl CGI module seems replace + with a space
+ request.open("GET", "supported-xml-content-types.cgi?type=" + escapedType, false);
+ request.send(null);
+ return request.responseXML;
+}
+
+function testXMLType(type, expected)
+{
+ var xmlResult = getXMLOfType(type);
+ var statusText = "FAIL (response type: " + request.getResponseHeader("Content-type") + ")";
+
+ if (xmlResult) {
+ statusText = "FAIL (got document -- response type: " + request.getResponseHeader("Content-type") + ")";
+ var typeElement = xmlResult.firstChild;
+ if (expected && typeElement) {
+ if (typeElement.textContent == type)
+ statusText = "PASS";
+ else
+ statusText = "FAIL (incorrect content: " + typeElement.textContent + " expected: " + type + ")";
+ }
+ } else if (!expected)
+ statusText = "PASS";
+
+ document.write("<p>" + statusText + " -- testing: " + type + " -- responseXML: " + xmlResult + "</p>");
+}
+
+// valid types
+testXMLType("text/xml", true);
+testXMLType("image/svg+xml", true);
+testXMLType("application/soap+xml", true);
+testXMLType("foo/bar+xml", true);
+testXMLType("123/BAR+xml", true);
+
+// They may be strange, but these should all be valid:
+testXMLType("foo_bar/baz+xml", true);
+testXMLType("foo-bar/baz+xml", true);
+testXMLType("foo+bar/baz+xml", true);
+testXMLType("foo~bar/baz+xml", true);
+testXMLType("foo!bar/baz+xml", true);
+testXMLType("foo$bar/baz+xml", true);
+testXMLType("foo^bar/baz+xml", true);
+testXMLType("foo{bar/baz+xml", true);
+testXMLType("foo}bar/baz+xml", true);
+testXMLType("foo|bar/baz+xml", true);
+testXMLType("foo%bar/baz+xml", true);
+testXMLType("foo'bar/baz+xml", true);
+testXMLType("foo`bar/baz+xml", true);
+testXMLType("foo#bar/baz+xml", true);
+testXMLType("foo&bar/baz+xml", true);
+testXMLType("foo*bar/baz+xml", true);
+
+// non-xml types
+testXMLType("text/html", false);
+testXMLType("image/png", false);
+
+
+// invalid types
+testXMLType("invalid", false);
+
+// FIXME: our code intentionally skips spaces, that seems wrong to me.
+// http://bugzilla.opendarwin.org/show_bug.cgi?id=8644
+testXMLType("foo bar/baz+xml", false);
+
+testXMLType("foo[bar/baz+xml", false);
+testXMLType("foo]bar/baz+xml", false);
+testXMLType("foo(bar/baz+xml", false);
+testXMLType("foo)bar/baz+xml", false);
+testXMLType("foo<bar/baz+xml", false);
+testXMLType("foo>bar/baz+xml", false);
+testXMLType("foo@bar/baz+xml", false);
+testXMLType("foo,bar/baz+xml", false);
+testXMLType("foo;bar/baz+xml", false);
+testXMLType("foo:bar/baz+xml", false);
+testXMLType("foo\\bar/baz+xml", false);
+testXMLType('foo"bar/baz+xml', false);
+testXMLType("foo/bar/baz+xml", false);
+testXMLType("foo?bar/baz+xml", false);
+testXMLType("foo=bar/baz+xml", false);
+
+</script>
+2006-04-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by andersca.
+
+ Make WebCore accept any */*+xml type as XML.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=5998
+ <rdar://problem/4031511> XmlHttpRequest doesn't allow responses with Content-Type: application/soap+xml
+
+ Test: http/tests/xmlhttprequest/supported-xml-content-types.html
+
+ * dom/DOMImplementation.cpp:
+ (WebCore::DOMImplementation::isXMLMIMEType):
+
2006-04-27 Eric Seidel <eseidel@apple.com>
* WebCore.vcproj/WebCore/WebCore.vcproj: Fix break from last checkin.
#include "ExceptionCode.h"
#include "css_stylesheetimpl.h"
#include "HTMLDocument.h"
+#include "RegularExpression.h"
namespace WebCore {
bool DOMImplementation::isXMLMIMEType(const String& mimeType)
{
- if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "application/xhtml+xml" ||
- mimeType == "text/xsl" || mimeType == "application/rss+xml" || mimeType == "application/atom+xml"
-#if SVG_SUPPORT
- || mimeType == "image/svg+xml"
-#endif
- )
+ if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl")
+ return true;
+ static const char* validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
+ static RegularExpression xmlTypeRegExp(DeprecatedString("^") + validChars + "+/" + validChars + "+\\+xml$");
+ if (xmlTypeRegExp.match(mimeType.deprecatedString()) > -1)
return true;
return false;
}
case CT_GAMMA:
[filter setValue:[NSNumber numberWithFloat:func.amplitude] forKey:@"inputAmplitude"];
[filter setValue:[NSNumber numberWithFloat:func.exponent] forKey:@"inputExponent"];
- [filter setValue:[NSNumber numberWithFloat:func.offset] forKey:@"inputOffset"];
+ [filter setValue:[NSNumber numberWithFloat:func.offset] forKey:@"inputOffset"];
break;
default:
//identity has no args
QChar c = contentTypeString[offset];
if (c == ';')
break;
- else if (c.isSpace())
+ else if (c.isSpace()) // FIXME: This seems wrong, " " is an invalid MIME type character according to RFC 2045. bug 8644
continue;
mimeType += String(c);
}