Bug 25979 - REGRESSION: WML support for local files is broken
Summary: REGRESSION: WML support for local files is broken
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nikolas Zimmermann
URL:
Keywords:
Depends on:
Blocks: 20393
  Show dependency treegraph
 
Reported: 2009-05-23 06:11 PDT by Nikolas Zimmermann
Modified: 2009-05-30 19:33 PDT (History)
3 users (show)

See Also:


Attachments
Initial patch, working around the problem. (2.01 KB, patch)
2009-05-23 06:14 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Updated patch (2.17 KB, patch)
2009-05-23 06:19 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Updated patch v2 (2.18 KB, patch)
2009-05-23 06:22 PDT, Nikolas Zimmermann
darin: review-
Details | Formatted Diff | Diff
Updated patch v3 (2.12 KB, patch)
2009-05-30 05:52 PDT, Nikolas Zimmermann
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2009-05-23 06:11:10 PDT
WML support for local files is broken since content sniffing has been turned off for local files on Mac/CFNetwork.

CFNetwork doesn't map the ".wml" file extension to the right WML MIME type. An Apple bug report has been opened to cover this issue. For the meanwhile, introduce a workaround to unbreak WML support on Mac.
Comment 1 Nikolas Zimmermann 2009-05-23 06:14:43 PDT
Created attachment 30616 [details]
Initial patch, working around the problem.
Comment 2 Nikolas Zimmermann 2009-05-23 06:19:58 PDT
Created attachment 30617 [details]
Updated patch

Oops, uploaded the wrong patch, missing an include. Adding Brady as reviewer, as we discussed this in private before.
Comment 3 Nikolas Zimmermann 2009-05-23 06:22:11 PDT
Created attachment 30618 [details]
Updated patch v2

"StdLibExtras.h" -> <wtf/StdLibExtras.h> to preserve Qt build. It's also more correct this way. Sorry for the noise :-)
Comment 4 Eric Seidel (no email) 2009-05-23 07:24:04 PDT
Can't we add the MIME type mapping somewhere in WebCore/WebKit instead of turning on sniffing for .wml fies?
Comment 5 Nikolas Zimmermann 2009-05-23 07:44:26 PDT
(In reply to comment #4)
> Can't we add the MIME type mapping somewhere in WebCore/WebKit instead of
> turning on sniffing for .wml fies?
Hm I'm unsure about that. Sounds fine in general. I'd love to hear Bradys opinion on that.

Comment 6 Darin Adler 2009-05-23 12:24:24 PDT
Comment on attachment 30618 [details]
Updated patch v2

This is the wrong place for this workaround. The correct workaround would be to do extension-based MIME type mapping, not to turn on MIME type sniffing. This code needs to go in a place that's determining MIME types, not a place that's deciding whether to do content sniffing.
Comment 7 Brady Eidson 2009-05-23 18:10:28 PDT
Eric and Darin are right - if we need to work around this, it needs to be based on extension -> MIME Type mapping.  The one catch-all place to do this is in the didReceiveResponse method closest to the platform layer.  We've done things like this recently in ResourceHandleMac.mm, I believe. 
Comment 8 Nikolas Zimmermann 2009-05-24 12:44:41 PDT
(In reply to comment #7)
> Eric and Darin are right - if we need to work around this, it needs to be based
> on extension -> MIME Type mapping.  The one catch-all place to do this is in
> the didReceiveResponse method closest to the platform layer.  We've done things
> like this recently in ResourceHandleMac.mm, I believe. 
Okay, I'm toying with this for some hours now until I found out didReceiveResponse is the "right spot" to do these hacks :-) But I still don't have any success. I added "[r _setMIMEType:@"text/vnd.wap.wml"];" as hack, just below the "m_handle->client()->didReceiveResponse(...)" call. That makes WebKit open the file and shows the file content, rendered as plain text. But I don't get any WML rendering.

But I'm probably just on the wrong track, can you give me a hint?

Thanks in advance,
Niko
Comment 9 Nikolas Zimmermann 2009-05-30 05:52:14 PDT
Created attachment 30803 [details]
Updated patch v3

Found another workaround, that fixes the problem without enabling content sniffing. Hopefully it's fine this time.
Comment 10 Darin Adler 2009-05-30 14:38:32 PDT
Comment on attachment 30803 [details]
Updated patch v3

Looks OK. r=me
Comment 11 Nikolas Zimmermann 2009-05-30 19:33:18 PDT
Landed in r44294.