Commit e7d249e3 authored by psolanki@apple.com's avatar psolanki@apple.com

2011-03-16 Pratik Solanki <psolanki@apple.com>

        Reviewed by Alexey Proskuryakov.

        REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001
        https://bugs.webkit.org/show_bug.cgi?id=56345

        Add test that verifies the we don't crash when an XHR response headers don't contain
        Content-Type.

        * http/tests/xmlhttprequest/resources/.htaccess:
        * http/tests/xmlhttprequest/resources/noContentType.asis: Added.
        * http/tests/xmlhttprequest/xmlhttprequest-no-content-type-expected.txt: Added.
        * http/tests/xmlhttprequest/xmlhttprequest-no-content-type.html: Added.
2011-03-16  Pratik Solanki  <psolanki@apple.com>

        Reviewed by Alexey Proskuryakov.

        REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001
        https://bugs.webkit.org/show_bug.cgi?id=56345

        Add NULL check for Content-Type header field.

        Test: http/tests/xmlhttprequest/xmlhttprequest-no-content-type.html

        * platform/network/mac/WebCoreURLResponse.mm:
        (WebCore::adjustMIMETypeIfNecessary):

git-svn-id: svn://svn.chromium.org/blink/trunk@81267 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 39af8b67
2011-03-16 Pratik Solanki <psolanki@apple.com>
Reviewed by Alexey Proskuryakov.
REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001
https://bugs.webkit.org/show_bug.cgi?id=56345
Add test that verifies the we don't crash when an XHR response headers don't contain
Content-Type.
* http/tests/xmlhttprequest/resources/.htaccess:
* http/tests/xmlhttprequest/resources/noContentType.asis: Added.
* http/tests/xmlhttprequest/xmlhttprequest-no-content-type-expected.txt: Added.
* http/tests/xmlhttprequest/xmlhttprequest-no-content-type.html: Added.
2011-03-16 Levi Weintraub <leviw@chromium.org>
Reviewed by Ryosuke Niwa.
......@@ -7,3 +7,6 @@ AddCharset koi8-r .txt
<Files "reply2.xml">
AddCharset windows-1251 .xml
</Files>
<Files "noContentType.asis">
DefaultType None
</Files>
Connection:keep-alive
Date:Wed, 16 Mar 2011 05:10:48 GMT
Server:nginx/0.7.62
Transfer-Encoding:Identity
Test case for Bug 56345: REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001
This test verifies that an XHR content with no Content-Type set does not crash the browser.
<html>
<head>
<title> Test case for bug 56345 </title>
</head>
<body>
<p> Test case for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=56345">56345</a>: REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001 </p>
<p> This test verifies that an XHR content with no Content-Type set does not crash the browser. </p>
<body>
<script type="text/javascript">
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function checkDone() {
layoutTestController.notifyDone();
}
var req = new XMLHttpRequest();
req.onload = checkDone;
req.open("GET", "resources/noContentType.asis", true);
req.send(null);
</script>
</body>
</html>
2011-03-16 Pratik Solanki <psolanki@apple.com>
Reviewed by Alexey Proskuryakov.
REGRESSION: Crash in adjustMIMETypeIfNecessary since r81001
https://bugs.webkit.org/show_bug.cgi?id=56345
Add NULL check for Content-Type header field.
Test: http/tests/xmlhttprequest/xmlhttprequest-no-content-type.html
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::adjustMIMETypeIfNecessary):
2011-03-15 Levi Weintraub <leviw@chromium.org>
Reviewed by Ryosuke Niwa.
......
......@@ -522,7 +522,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
CFHTTPMessageRef message = wkGetCFURLResponseHTTPResponse(cfResponse);
if (message) {
RetainPtr<CFStringRef> contentType(AdoptCF, CFHTTPMessageCopyHeaderFieldValue(message, CFSTR("Content-Type")));
if (CFStringHasPrefix(contentType.get(), CFSTR("text/plain"))) {
if (contentType && CFStringHasPrefix(contentType.get(), CFSTR("text/plain"))) {
static CFSetRef binaryExtensions = createBinaryExtensionsSet();
RetainPtr<NSString> suggestedFilename(AdoptNS, (NSString *)wkCopyCFURLResponseSuggestedFilename(cfResponse));
if (!CFSetContainsValue(binaryExtensions, (CFStringRef) [[suggestedFilename.get() pathExtension] lowercaseString]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment