Changeset 160965 in webkit


Ignore:
Timestamp:
Dec 21, 2013 6:40:53 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Test /webkit2/WebKitWebResource/mime-type fails when run after /webkit2/WebKitWebView/resources
https://bugs.webkit.org/show_bug.cgi?id=126119

Reviewed by Martin Robinson.

The problem is that when the blank.ico resource is loaded from the
disk cache, the mime type is null, because the soup cache doesn't
cache sniffed mime types. This doesn't happen when a resource is
loaded form the memory cache, because the ResourceResponse is
cached, not only the headers. I think the disk cache should also
cache the sniffed content type, but that needs to be done in
soup. For now we can workaround the issue in the unit test by
making sure that resources that can be cached, also include the
Content-Type header, this way the mime type won't be sniffed and
it will be cached as a HTTP header in the disk cache.

  • UIProcess/API/gtk/tests/TestResources.cpp:

(serverCallback): Add Content-Type header for resources that can
be cached.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r160964 r160965  
     12013-12-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Test /webkit2/WebKitWebResource/mime-type fails when run after /webkit2/WebKitWebView/resources
     4        https://bugs.webkit.org/show_bug.cgi?id=126119
     5
     6        Reviewed by Martin Robinson.
     7
     8        The problem is that when the blank.ico resource is loaded from the
     9        disk cache, the mime type is null, because the soup cache doesn't
     10        cache sniffed mime types. This doesn't happen when a resource is
     11        loaded form the memory cache, because the ResourceResponse is
     12        cached, not only the headers. I think the disk cache should also
     13        cache the sniffed content type, but that needs to be done in
     14        soup. For now we can workaround the issue in the unit test by
     15        making sure that resources that can be cached, also include the
     16        Content-Type header, this way the mime type won't be sniffed and
     17        it will be cached as a HTTP header in the disk cache.
     18
     19        * UIProcess/API/gtk/tests/TestResources.cpp:
     20        (serverCallback): Add Content-Type header for resources that can
     21        be cached.
     22
    1232013-12-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp

    r154567 r160965  
    678678        soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kStyleCSS, strlen(kStyleCSS));
    679679        addCacheHTTPHeadersToResponse(message);
     680        soup_message_headers_append(message->response_headers, "Content-Type", "text/css");
    680681    } else if (g_str_equal(path, "/javascript.js")) {
    681682        soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kJavascript, strlen(kJavascript));
     
    695696        soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, contents, contentsLength);
    696697        addCacheHTTPHeadersToResponse(message);
     698        soup_message_headers_append(message->response_headers, "Content-Type", "image/vnd.microsoft.icon");
    697699    } else if (g_str_equal(path, "/simple-style.css")) {
    698700        static const char* simpleCSS =
Note: See TracChangeset for help on using the changeset viewer.