Bug 55412

Summary: Frequent crashes in CFURLCache code on Snow Leopard
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebKit2Assignee: Alexey Proskuryakov <ap>
Severity: Normal Keywords: InRadar
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.6   
See Also: https://bugs.webkit.org/show_bug.cgi?id=144339
Description Flags
proposed fix mitz: review+

Description Alexey Proskuryakov 2011-02-28 14:32:22 PST
We're passing a wrong path when creating an NSURLCache, so it can't initialize an SQL database, and misbehaves.

Comment 1 Alexey Proskuryakov 2011-02-28 14:40:30 PST
Created attachment 84125 [details]
proposed fix
Comment 2 mitz 2011-02-28 14:50:05 PST
Comment on attachment 84125 [details]
proposed fix

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

> Source/WebKit2/ChangeLog:18
> +        like have liked trailing slash).

extra “like”

> Source/WebKit2/Shared/WebProcessCreationParameters.h:83
> +    // FIXME: These should not be merged with CFURLCache counterparts below.


> Source/WebKit2/UIProcess/mac/WebContextMac.mm:85
> +    ASSERT(parameters.nsURLCachePath.data()[strlen(parameters.nsURLCachePath.data()) - 1] != '/'); // Necessary for NSURLCache to find the cache file.

Should we assert that strlen(…) is > 0 first?

> Source/WebKit2/UIProcess/win/WebContextWin.cpp:68
> +    if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')

and here
Comment 3 Alexey Proskuryakov 2011-02-28 15:07:16 PST
Fixed in http://trac.webkit.org/changeset/79927.

Note that there is some controversy around whether it's really OK for CString length to not match strlen. But we already use strlen with -[NSFileManager stringWithFileSystemRepresentation:length:] elsewhere.