[webkit-dev] WebKit caching
Adam Thorsen
adam.thorsen at gmail.com
Sun Apr 12 09:15:19 PDT 2009
I removed the willSendRequest method and set the cache model and disk
capacity ( without setting the memory capacity ) with the same
results. Is this enough information to file a bug report with or is
there some more work I could do to track this down?
Thanks again,
-Adam
On Apr 11, 2009, at 11:51 PM, Darin Adler wrote:
> On Apr 11, 2009, at 6:54 PM, Adam Thorsen wrote:
>
>> I also noticed recently that there is a "Disable Caches" option
>> under the Develop menu on Safari. I tested it using the same
>> procedure and it indeed did not cache the javascript, so I know
>> this is possible one way or another.
>
> It’s true, Disable Caches does this.
>
> In fact, I read over the implementation of that menu item before
> answering your original question. All that Safari does when that
> menu item is selected is:
>
> [[WebPreferences standardPreferences]
> setCacheModel:WebCacheModelDocumentViewer];
> [[NSURLCache sharedURLCache] setDiskCapacity:0];
>
> I’m not sure why that works better in Safari than in your test
> application.
>
>> NSURL * url = [aRequest URL];
>> NSURLRequest * cachelessRequest = [NSURLRequest
>> requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData
>> timeoutInterval:100];
>> return cachelessRequest;
>
> This code in your willSendRequest delegate method may be causing a
> problem. It discards the request and creates a new one, taking only
> the URL from the original request. That’s a problem because there
> are other important fields in the request, such as the HTTP method,
> HTTP body, and HTTP header fields. If you want to change the cache
> policy (and you should not need to do this, see my original
> message), you would need code more like this:
>
> if ([request cachePolicy] == NSURLRequestReloadIgnoringCacheData)
> return request;
>
> NSURLRequest *cachelessRequest = [aRequest mutableCopy];
> [cachelessRequest
> setCachePolicy:NSURLRequestReloadIgnoringCacheData];
> return cachelessRequest;
>
> Hope that helps.
>
> -- Darin
>
More information about the webkit-dev
mailing list