redouanbeg
redouanbeg

Reputation: 1

Clear cache with GeckoFx 20

I use Geckofx 22.0.7.0 and XULRunner 22, I want to delete the browser cache. I have already found a code but it shows me an error: Gecko.Cache.CacheService.Clear (new CacheStoragePolicy ()); The error is : the method or operation is not implemented - NotImplementedException was unhandled.

// https://developer.mozilla.org/enUS/docs/Mozilla/Tech/XPCOM/Reference/Interface/imgICache  
   Gecko.Cache.ImageCache.ClearCache(true);
   Gecko.Cache.ImageCache.ClearCache(false);

// Defaults to all devices(0) - https://bitbucket.org/geckofx/geckofx-9.0/issue/7/idl-translation-bug-for-enums
   Gecko.Cache.CacheService.Clear(new CacheStoragePolicy());`

Upvotes: 0

Views: 1919

Answers (2)

vaddy
vaddy

Reputation: 77

thank you Paul for the answer, I'v modifed it and testing it out for a C sharp using the following code.

nsICookieManager cookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1");
cookieMan = Xpcom.QueryInterface<nsICookieManager>(cookieMan);
cookieMan.RemoveAll();

Upvotes: 1

Paul
Paul

Reputation: 78

This is how you clear everything:

Dim CookieMan As nsICookieManager
CookieMan = Xpcom.GetService(Of nsICookieManager)("@mozilla.org/cookiemanager;1")
CookieMan = Xpcom.QueryInterface(Of nsICookieManager)(CookieMan)
CookieMan.RemoveAll()

To convert code, you can use http://converter.telerik.com/

Upvotes: 1

Related Questions