2

I'm new to embedded browsers, I admit, but I've got a GeckoFX v33 control working and hosted in a WPF application. Browsing and caching is working during a browsing session. However, upon application restart the cache is lost (or ignored) and all web assets are re-downloaded!

I'm quite dumbfounded why this isn't enabled by default, as it is a web browser control after all.

I've tried setting a custom profile path to an existing directory with write access:

var path = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "xulrunner");
Gecko.Xpcom.ProfileDirectory = System.IO.Path.Combine( Directory.GetCurrentDirectory(), "webcache");
Gecko.Xpcom.Initialize(path);

I've also tried setting various combinations of preferences i.e.

Gecko.GeckoPreferences.User.SetBoolPref("browser.cache.disk.enable",true);                
Gecko.GeckoPreferences.User.SetIntPref("Browser.cache.disk.capacity", 50000);

However, it ALWAYS loads the web assets again on app restart!

Does anyone know the correct configuration to get geckoFX or xulRunner to look at the last cache on startup?

Thanks in advance!

Dale
  • 8,772
  • 1
  • 15
  • 15

1 Answers1

0

OK, so I have narrowed down this bug to the geckofx-33.0 version.

Downgrading to geckofx-31.0-01 or lower fixed my problem and the cache is persisted (in the /cache2 folder, created automatically).

I tested the following combinations (OS: Windows):

  • GeckoFx 29.0-015.zip with xulRunner 29.0.1.en-US.win32.zip: Disk caching WORKS!

  • GeckoFx 31.0-01.zip with xulRunner 31.0.en-US.win32.zip: Disk caching WORKS!

  • GeckoFx 33.0-02.zip with xulRunner 33.0.2.en-US.win32.zip: Disk caching FAILS!

I was using the 33 version above (as it was the latest version!) and hence could not get disk caching to work. I definitely think this is a bug, as it is reproducible each time. I don't know if the bug lies in geckoFx or the xulRunner runtime, but I'll leave this up to the developers brains-trust to fix. I believe the cache API changed in v33.

So, for now I guess I'll just fallback to version 31 and wait for a fix.

Dale
  • 8,772
  • 1
  • 15
  • 15