Bug 59697 - [Soup] does not load css stylesheets without content-type
Summary: [Soup] does not load css stylesheets without content-type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://open.mapquest.co.uk/
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 06:42 PDT by arno.
Modified: 2011-04-28 11:24 PDT (History)
4 users (show)

See Also:


Attachments
Patch (6.49 KB, patch)
2011-04-28 07:08 PDT, arno.
no flags Details | Formatted Diff | Diff
patch v1.1 (6.49 KB, patch)
2011-04-28 07:35 PDT, arno.
no flags Details | Formatted Diff | Diff
patch v1.2 (6.75 KB, patch)
2011-04-28 07:54 PDT, arno.
no flags Details | Formatted Diff | Diff
patch v1.3 (6.75 KB, patch)
2011-04-28 08:14 PDT, arno.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arno. 2011-04-28 06:42:19 PDT
Hi,
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

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)