Bug 25979

Summary: REGRESSION: WML support for local files is broken
Product: WebKit Reporter: Nikolas Zimmermann <zimmermann>
Component: Page LoadingAssignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, darin, staikos
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 20393    
Attachments:
Description Flags
Initial patch, working around the problem.
none
Updated patch
none
Updated patch v2
darin: review-
Updated patch v3 darin: review+

Nikolas Zimmermann
Reported 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.
Attachments
Initial patch, working around the problem. (2.01 KB, patch)
2009-05-23 06:14 PDT, Nikolas Zimmermann
no flags
Updated patch (2.17 KB, patch)
2009-05-23 06:19 PDT, Nikolas Zimmermann
no flags
Updated patch v2 (2.18 KB, patch)
2009-05-23 06:22 PDT, Nikolas Zimmermann
darin: review-
Updated patch v3 (2.12 KB, patch)
2009-05-30 05:52 PDT, Nikolas Zimmermann
darin: review+
Nikolas Zimmermann
Comment 1 2009-05-23 06:14:43 PDT
Created attachment 30616 [details] Initial patch, working around the problem.
Nikolas Zimmermann
Comment 2 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.
Nikolas Zimmermann
Comment 3 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 :-)
Eric Seidel (no email)
Comment 4 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?
Nikolas Zimmermann
Comment 5 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.
Darin Adler
Comment 6 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.
Brady Eidson
Comment 7 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.
Nikolas Zimmermann
Comment 8 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
Nikolas Zimmermann
Comment 9 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.
Darin Adler
Comment 10 2009-05-30 14:38:32 PDT
Comment on attachment 30803 [details] Updated patch v3 Looks OK. r=me
Nikolas Zimmermann
Comment 11 2009-05-30 19:33:18 PDT
Landed in r44294.
Note You need to log in before you can comment on or make changes to this bug.