Bug 59697

Summary: [Soup] does not load css stylesheets without content-type
Product: WebKit Reporter: arno. <a.renevier>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: abarth, commit-queue, eric, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
URL: http://open.mapquest.co.uk/
Description Flags
patch v1.1
patch v1.2
patch v1.3 none

Description arno. 2011-04-28 06:42:19 PDT
when a css stylesheet has no content-type, and a random file extension (such as php), that css sheet is not loaded. This happens for example with http://open.mapquest.co.uk/ : site fails with webkit/gtk but fails with other browsers.

In CachedCSSStyleSheet::canUseSheet, there is following comment:
    // Note that we grab the Content-Type
    // header directly because we want to see what the value is BEFORE content
    // sniffing.
So, it looks like Content-Type header should match official Content-Type, but soup backend replaces it with the sniffed one.
So may be, sniffed Content-Type should be kept in a separate variable, and not be injected into soup message headers.
Comment 1 arno. 2011-04-28 07:08:05 PDT
Created attachment 91487 [details]

patch attempt
Comment 2 arno. 2011-04-28 07:35:50 PDT
Created attachment 91489 [details]
patch v1.1

prevents a memory leak
Comment 3 Gustavo Noronha (kov) 2011-04-28 07:47:01 PDT
Comment on attachment 91489 [details]
patch v1.1

View in context: https://bugs.webkit.org/attachment.cgi?id=91489&action=review

Just a style nit.

> Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:345
> +                    soup_header_g_string_append_param(str, (const char*) key, (const char*) value);

This should use C++-style casts like this: static_cast<const char*>(key).
Comment 4 arno. 2011-04-28 07:54:26 PDT
Created attachment 91490 [details]
patch v1.2

fixes style
Comment 5 arno. 2011-04-28 08:14:16 PDT
Created attachment 91493 [details]
patch v1.3

fixes style
Comment 6 Gustavo Noronha (kov) 2011-04-28 08:18:37 PDT
Comment on attachment 91493 [details]
patch v1.3

Great work, thanks!
Comment 7 WebKit Commit Bot 2011-04-28 10:47:47 PDT
The commit-queue encountered the following flaky tests while processing attachment 91493 [details]:

http/tests/xmlhttprequest/cross-origin-authorization.html bug 52398 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 8 WebKit Commit Bot 2011-04-28 10:49:31 PDT
Comment on attachment 91493 [details]
patch v1.3

Clearing flags on attachment: 91493

Committed r85207: <http://trac.webkit.org/changeset/85207>
Comment 9 WebKit Commit Bot 2011-04-28 10:49:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 WebKit Review Bot 2011-04-28 11:24:57 PDT
http://trac.webkit.org/changeset/85207 might have broken SnowLeopard Intel Release (Tests)