On Sep 12, 2011, at 5:37 PM, aaron reed wrote:

> I'm embedding WebKit on my own Windows c# control and I'd like to clear the 
> cache for WebKit.  I tried doing this:
> 
> HRESULT WKWrapper::emptyCache()
> {
>     IWebCache *webCache = NULL;
>     HRESULT rv = WebKitCreateInstance(CLSID_WebCache, 0, IID_IWebCache, 
> (void**)&webCache);
>     if (FAILED(rv)) {
>         return rv;
>     }
>     if (!webCache) {
>         return E_FAIL;
>     }
>     rv = webCache->empty();
>     webCache->Release();
>     return rv;
> }
> 
> This doesn't seem to clear the cache, though.  I still have to reload the 
> page to see changes to the web page.

I'm not sure what you mean here. Are you expecting IWebCache::empty to cause 
all pages to reload immediately so that the new resources will be fetched?

> Navigating forward or backward won't show the changes.  But emptying the 
> cache in Safari and then navigating forward or backward
> will show the changes.
> 
> Am I missing something?  Is there some way to get the WebCache object from 
> WebKit by querying it?  Looking at the code
> that didn't seem necessary (since everything WebCache::empty() calls is 
> static).

IWebCache doesn't modify any cache(s) that the network layer maintains. So you 
probably need to figure out what network layer your version of WebKit is using 
and do something to empty its cache(s).

-Adam

_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help

Reply via email to