Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Cache Fixer
Posted by: Alex.Tarantul
Date: December 02, 2009 06:52AM

It is a question not absolutely of expansion, but it is important for K-Meleon users. Studying an source code of expansion Cache Fixer for Firefox, I have found an interesting key which is added in about:config. It is necessary to create a logic key browser.cache.disk.cache_fixer_debug with value true. Now the browser cache will be reliably protected from nulling at emergency end of work of the computer.
For example, if the electricity is suddenly disconnected, usually the browser cache is nulled at the subsequent restart of a browser. However if after computer reboot to open a cache folder manually (but not to start the K-Meleon) it is possible to see that the cache remains in safety. The cache is nulled only at K-Meleon start. The key specified above prevents cache nulling. I wish to notice that in Russian build K-Meleon Pro the given key by default is used within several months. Negative results when on some computers the cache is nulled despite presence of the specified key are observed. The given situation demands detailed consideration and studying of options of a browser in aggregate.

Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 02, 2009 01:57PM

Okay, I tried now as you said, several times.
Alas, no chance. Cache is deleted when calling the first page to load, with or without that key :-(
win98se, KM153, gecko 1.8.23 by desga/guenter

Options: ReplyQuote
Re: Cache Fixer
Posted by: Alex.Tarantul
Date: December 02, 2009 05:09PM

On my computer it works. Win XP K-Meleon 1.5.3.

Options: ReplyQuote
Re: Cache Fixer
Posted by: Doon
Date: December 03, 2009 06:48PM

I was hopeful, but it did not work for me. I entered the key using the steps shown in the image below, I then restarted K-Meleon. I tested the function using two methods: I browsed a website that always crashes the browser, I also used a process killer. In both cases the cache would be deleted as soon as a new page was loaded (as usual), the previous session choice did not matter. Using default K-Meleon 1.5.3 on Win98.

I almost stopped using K-Meleon because of the way it deletes the cache, so I would really like a solution to the problem. I'm sorry this didn't work.



Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 03, 2009 07:21PM

it's definitely working here..thanks alex

when set to true, the cache was intact..set to false it was completely removed

tested with both reset button (dirty reboot) and browser crash
for quick testing, you can crash here:
http://upload.wikimedia.org/wikipedia/commons/2/2a/Eta_Carinae_Nebula_1.jpg

door, after setting the value to true..make sure to restart kmeleon first before testing..also after restarting..about about:config again to check that the value is sticking to true..in case of loader.exe, make sure to restart the loader as well

Options: ReplyQuote
Re: Cache Fixer
Posted by: desga2
Date: December 03, 2009 11:31PM

Firefox 2.0.0.22pre and K-Meleon 1.5.3 with Gecko updated to 1.8.1.23 not crash with disrupted's above crash link. tongue sticking out smiley

K-Meleon in Spanish

Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 04, 2009 12:19AM

No, the nebula don't crash on me either smiling smiley But was there only with "all shields up", no time for more experimenting right now, LOL!
After some very time-consuming power-off kills I tried killing with process explorer, that has the same effect :cool:

I tested and tested and tested and searched with that cache problem, but don't manage to find a workaround either :-(
That Firefox addon posted by Alex has some very enlightening information on it's project page though:
http://imglikeopera.mozdev.org/cache_fixer.html
(addon page: https://addons.mozilla.org/en-US/firefox/addon/6859)

Quote
CvP
The cache, no matter how big or small, has the bug 105843:

* On startup, Mozilla loads the index file (_CACHE_MAP_) into memory;
* Mark _CACHE_MAP_ on disk with "dirty" flag;

* ...(working)...
* Write _CACHE_MAP_ from memory on disk without "dirty" flag on shutdown;
o so, if Mozilla crashes at step 3, step 4 is skipped and _CACHE_MAP_ (on disk) keeps the "dirty" flag;
* On next startup, Mozilla checks the flag and if it is "dirty", cleans up all cache;

Cache Fixer extension drops the "dirty" flag on every startup and if Mozilla crashes, you still loose cached data, but only the current (crashed) session. I think it’s better, than loosing all cached data.

So at least I learned now, that copying the cache folder doesn't help anything if copying while the browser is still running, it must be closed! Otherwise the cache is still wrongly flagged "dirty" and therefore unusuable, it will be deleted whenever trying to view something from it in the browser!

Then only external cache viewers like the one from Nirsoft can show the content of cache-map dirty-flagged cache folders, that is as long as their file-size isn't zero yet (on my machine anyways it freezes). That thing is very cool btw, and there's even a KM macro for it, although it also works perfectly stand-alone:
www.nirsoft.net/utils/mozilla_cache_viewer.html

Ah yes, while experimenting I realized that in fact scandisk "deletes" the cache - although not the contents, but the "content map", the first four files in cache get size zero. Of course, scandisk can be stopped before deleting them, that's really the least problem here.
The big problem is that the browser engine fully intentionally deletes the cache, if the browser isn't closed cleanly!! And so it doesn't help anything to copy the folder, if the last session wasn't closed normally.

Perhaps someone could adapt that firefox addon for KM?? It says it resets the cache-map flag to "clean" at the START of the browser. Yeah, firefox not KM, but guess in that regard FF and KM are twins again :-P

Can't figure out if the memtioned pref has any effect, except that it may well keep the cache longer, after restarting to browse. But that doesn't help much, because it's contents are just not usuable, at the first click in history offline or clicking "view cache" the cache will still be deleted, at least on my machine :-(



Edited 4 time(s). Last edit at 12/04/2009 12:28AM by siria.

Options: ReplyQuote
Re: Cache Fixer
Posted by: Doon
Date: December 04, 2009 01:35AM

I've certainly learned a lot today, along with Siria it seems. I read the Cache Fixer page (and looked into it's files) and also read the long and interesting bug 105843 page, which describes how this whole issue is intentional, and shows how it's been neglected by developers for many years. Essentially, the whole mozilla cache system is poorly designed and would need to be entirely rewritten. I might add that the poor mozilla cache system (along with Firefox's poor performance) is what kept me with IE up until my recent love affair with K-Meleon, after which I discovered the cache deletion problem. Say what you will about IE but it's cache system is the best of all, files are written as they are downloaded and you can browse and search them with ease, not to mention being as stable as granite.

Having looked at the Cache Fixer files and seen their relative simplicity I am now skeptical that the preference listed above could do anything without the fixer .JS routines to plug into (keyword: fixer). So, Disrupted, since you seem to have verified the functionality I would like to encourage you to try it with a fresh, isolated instance of K-Meleon, to insure there are no other updates or experimental leftovers that could skew the results.


In any event, I now understand that the _CACHE_MAP_ is basically only written to as the browser closes, updated with data held in memory during a session. Tests have already prooven that backing up this file at an appropriate time and restoring it as necessary will finally allow me to keep my precious cache, although I'll lose data from the last session. Hopefully corruption will not become a problem.


Thank you Alex! You've led me to the key I needed.

Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 04, 2009 09:51AM

Guys it works!!!*shock*

At least it seems so to me know, am a bit excited at the moment so please try this too, if it's actually true??
Simply copy that cacheFixer.js from the addon into the components folder (and as usual deleting xpti.dat and compreg.dat). And of course, add that about:config key found by Alex.

The last session is lost, seems to be true, and alas also some of the html pages, but the folder or cache-map aren't deleted, and the Nirsoft cacheviewer shows tons of images etc. Also opening the built in KM cache viewer shows tons of entries, although not all can be opened, but better some entries lost than all.

Alex and CvP (Danil Ivanov in license.txt) really seem to have found a good workaround here - Great!! And thanx! grinning smiley grinning smiley grinning smiley



Edited 3 time(s). Last edit at 12/04/2009 11:16AM by siria.

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 04, 2009 11:48AM

great find siria... strange though because it works here and i don't have the cachefixer.js.. maybe i fidled with it before or some other component enabled it..the mysteries of gecko.

i haven't tested it yet with my test kmeleon(default installation profile) but it most probably has to do with that component needs to be registered.

i fund an easy way to ensure the pref is working is by opening the error console after a crash..it should have those messages:


desga, i didn't install the unofficial patch on the default kmeleon because of bug testing i want to keep it the same as official..now i'm envious grinning smiley, my 1.1.4 however uses the unofficial patch

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 04, 2009 11:51AM

on a normal exit:


Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 04, 2009 02:47PM

Cool again, now that's an easy prove grinning smiley

Yes, perhaps that fixer is already in one of your other components, that would be a good explanation why that key works for some people and not for others.
Perhaps do a little explorer search for the term "[fixer]:" in the program folder...

But I wonder, wouldn't it possibly cause problems if someone has two cache-fixers in KM...?

I tried again *without* cachefixer, and clearly, there are no fixer-messages anymore in the error console. That thing really is the reason (in my version).

BTW scandisk is no danger anymore either, just tested it again grinning smiley Makes sense, because the cache map has no dirty flag anymore, so scandisk leaves it alone.

Edit: On a firefox extension site are mentioned session saver, crash recovery and tabmix plus as related (or including) cache fixer...



Edited 2 time(s). Last edit at 12/04/2009 04:45PM by siria.

Options: ReplyQuote
Re: Cache Fixer
Posted by: guenter
Date: December 04, 2009 07:08PM

Quote
siria

Simply copy that cacheFixer.js from the addon into the components folder (and as usual deleting xpti.dat and compreg.dat).

And of course, add that about:config key found by Alex.

Alex and CvP (Danil Ivanov in license.txt) really seem to have found a good workaround here - Great!! And thanx! grinning smiley grinning smiley grinning smiley

1.) AFAIK only needed to register xpt (in components). This big cacheFixer.js is js. Can someone verify or knows for sure?

2.) Just copy the small

./cache_fixer-1.0-fx/defaults/preferences/cacheFixer.js

to ./k-meleon/defauls/pref/cacheFixer.js

that AFAIK adds the pref also.

3.) very much so to Alex and CvP and to all ppl in this thread.
You all gave me nice start into my weekenend.

We can ask alain to make an installable now :B

p.s. possibly can be activated by accident - that would account for positive results in some cases before the js was in components. If I read right the cacheFixer.js that is in components talks to a dll or xpt.



Edited 2 time(s). Last edit at 12/04/2009 07:25PM by guenter.

Options: ReplyQuote
Re: Cache Fixer
Posted by: Alex.Tarantul
Date: December 04, 2009 07:35PM

Greetings, colleagues! I now have not enough time for researches of a discussed key, therefore I hope you will not lose interest to the given problem and we together will achieve any results. I thank all of you for participation in testing smiling smiley

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 05, 2009 12:13AM

no, i only got the messages after registering cachefixer.js.. i didn't get the messages before but the pref worked..that's why i suspect that some other component enabled the service already in gecko..it's very hard to find which one because there are so many.. i'll need to filter out non-related ones and then have to look inside the rest. that component is most probably included in the russian kmeleon by default.

the ff addon has 2 js..the pref one for the default setting that can be included to prefs but optional and the other one is the component which must be added t oatleast get the messages in the error console or enable the service if it wasn't enabled by whatever other component file.

both compreg.dat and xpti.dat must be deleted to register the file (or use extension manager or keith
http://kmext.sourceforge.net/files/cachefixer.7z

the extension includes the pref js so the pref will be enabled by default if you didn't add it before. there's also a macro to easy toggle the pref on and off


# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# -------cache fixer menu:toggle cachefixer

cachefixon{
menuchecked=(getpref(BOOL,"browser.cache.disk.cache_fixer_debug")=="true");
togglepref(BOOL,"browser.cache.disk.cache_fixer_debug");
$cachefixstat=getpref(BOOL,"browser.cache.disk.cache_fixer_debug");
$cachefixstat==true?&cfixactive:&cfixinactive;
}

cfixactive{
statusbar("cache fixer activated");
}

cfixinactive{
statusbar("cache fixer disactivated");
}

cachefix_BuildMenu{
setmenu("_Config_General",macro,"Activate Cachefix",cachefixon,13);
}

#---------------------------------------------------------------
$OnInit=$OnInit."cachefix_BuildMenu;";
$macroModules=$macroModules."cachefix_toggle;";


Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 05, 2009 01:10AM

Fantastic - thanx! grinning smiley Man, how much trouble this is solving for many people, and that solution is already from 2005!!

Just one little thing, I always feel a bit bad if no hint of credits are included anywhere, at least if something isn't trivial, and this sure is not. The original addon contains a license file and detailed infos in the install.rdf, and IMHO it wouldn't be much trouble to include at least the homepage on mozdev in the KM macro, huh... smiling smiley

I wonder a bit if you're really sure that it worked without the js - for my KM it took longer to delete the entries, IIRC it was no prob to open new tabs etc. and the cache was still there, but the problem was, nothing could be openend from history in offline mode, or when clicking "view cache" - as soon as the browser tried to actually READ something from cache, only then the cache-map was deleted.
But it's well possible of course that this function is also contained in another extension, especially since over at Firefox this is mentioned for a few (session saver, tabmix, crash recovery, ..). But if so, how figure it out??



Edited 1 time(s). Last edit at 12/05/2009 12:05PM by siria.

Options: ReplyQuote
Re: Cache Fixer
Posted by: Doon
Date: December 06, 2009 06:53AM

It works! Thank you, everyone. Good work.

"Simply copy that cacheFixer.js from the addon into the components folder (and as usual deleting xpti.dat and compreg.dat)." - siria

"both compreg.dat and xpti.dat must be deleted to register the file" - disrupted

Those files, in the components folder, need to be deleted so they can be automatically rebuilt the next time the browser starts. THAT was some key info I would never have known to do (I haven't played with extensions). In fact, I had somehow overlooked or didn't understand those instructions at first, and paid the price -- the fixer didn't work after many tests, until I read this thread again and it finally sunk in.




I also suspect that siria is correct that the "browser.cache.disk.cache_fixer_debug key" (only) works for some people because cache fixer is embedded in other extensions.



Edited 1 time(s). Last edit at 12/06/2009 08:02AM by Doon.

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 06, 2009 05:18PM

ok, macro updated with credits. i'm sure it worked because i used nircache viewer and all the cache files were there and the ffiles were accessible after crashing. i can open the images etc..i haven't tried to convert xul extensions in a long time so i can't remember what last thing that could have enabled it and what last component that could have enabled it. what is session saver? i have the scroll position saver for ssl pages converted by gunter but i can't remmber if it had component files

Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 06, 2009 06:12PM

Thanks for the update disrupted smiling smiley

Quote
disrupted
i'm sure it worked because i used nircache viewer and all the cache files were there and the ffiles were accessible after crashing.

Well yes, but that's exactly the trap: This way they were there for me too - but only until the moment when I first tried to actually READ something from cache with KMELEON. Then -BANG- the cache-map was nulled :-(
I suspect that already that key alone postponed the moment of deletion. Without it, the first open tab would destroy everything. And with it, only the first opened cache-file would destroy the cache-map.

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 10, 2009 03:13AM

no, that's not how it's happening on my computer..even without the cachfixer component and with the pref set to true; i was able to access the cache files normally after a crash/scan disk..opening several files without problems.. however when the pref was set to false the cache became empty after a crash. also for confirmation i tested with default kmeleon installation(test version) and the pref had no affect.

i made a desktopcapture showing cache intact with the pref set to true and without cachefixer:
http://www.youtube.com/watch?v=hro9r2JO9W0

the steps in the video:
1- first deleted cachefixer.js component and removed xpti and compreg to refresh components
2- fired kmeleon..set the pref to true and restarted km
3- i checked the integrity of kmeleon cache before crashing it
4- crashed kmeleon (force terminate-kill)
5- opened kmeleon again and opened the cache, browsed through it and opened several files
6- opened the error console- no messages related to cachefixer component

the only affect cachefixer's component has is that it includes the messages in the error console, so there must be another component that enables the pref but it will be hard to pinpoint it, i have 55 more component files than the default installation(198 components vs 143 for the def km)

you can view the original video(better resolution) there:
http://kmext.sourceforge.net/media/kmeleoncache.avi but might require the camstudio lossless codec

Options: ReplyQuote
Re: Cache Fixer
Posted by: Alex.Tarantul
Date: December 10, 2009 06:58PM

I have a similar situation with K-Meleon cache on my computer smiling smiley

Options: ReplyQuote
Re: Cache Fixer
Posted by: siria
Date: December 10, 2009 07:45PM

@Alex:
This cachefixer works fine on all computers. Only some people need additionally the cachefixer.js in components, and some others do not. So they must have it already somewhere included, inside another component or macro - just where??
Can you and collegues perhaps compare folders and figure out what you have in common, and what's missing for those, who need cachefixer.js additionally...? :cool:

--------------

Это cachefixer прекрасно работает на всех компьютерах. Только некоторые люди нуждаются в дополнительной cachefixer.js в компонентах, и некоторые другие не делают. Поэтому они должны быть где-то она уже включена, внутри другого компонента или макрос - только где? Можете ли вы и коллеги, возможно, сравнение папок и выяснить, что у вас есть общего, и чего не хватает для тех, кто нуждается cachefixer.js Кроме того ... ?

---------------
Those are mine, no hidden cachefixer in them --> need .js to work:
(Win98SE, KM153, gecko-23)

accel.kmm
capplus.kmm
cfg.kmm
console2.kmm
cookieculler.kmm
DEP.kmm
docinfo.kmm
domcomplete.kmm
encoding.kmm
fastedit.kmm
firefox.kmm
foolproof.kmm
googlecache.kmm
hotlink.kmm
ie.kmm
imgedplus.kmm
imgpropplus9x.kmm
invertcolours.kmm
keepvid.kmm
KmBBcode.kmm
kmcoder.kmm
kmextsearch.kmm
kmfireftp.kmm
kmikb.kmm
KmSmiley.kmm
mail.kmm
main.kmm
main2.kmm
managehosts.kmm
mtypes.kmm
networkmenu.kmm
newsfox.kmm
nukeimage.kmm
OnlyVideo.kmm
policyman.kmm
preferential.kmm
proxy.kmm
pseudohistSB(exp).kmm
RCCopyLink.kmm
reload.kmm
search.kmm
sendto.kmm
servers.kmm
sidebars.kmm
specialcharcs.kmm
styles.kmm
tabbarbottom_fstoggle.kmm
tabclosebtn.kmm
tineye.kmm
translate.kmm
useragent.kmm
webdev.kmm
zoom.kmm

---------------------
Hmm... on second thought, perhaps comparing would be easier if sending a zipped folder, then compare in a filemanager? ;-)



Edited 4 time(s). Last edit at 12/10/2009 08:32PM by siria.

Options: ReplyQuote
Re: Cache Fixer
Posted by: disrupted
Date: December 11, 2009 11:49AM

there's an easier way..russian kmeleon(1.5.3 pro) comes with some extensions preinstalled.. one of them is probably the one with the components file

Options: ReplyQuote
Re: Cache Fixer
Posted by: Alex.Tarantul
Date: December 11, 2009 05:34PM

@siria
Yes, we can compare, but it takes some time (few days). I have a lot of my official work now and have not free time. So, I will do it soon smiling smiley

Options: ReplyQuote
Re: Cache Fixer
Posted by: Mister M
Date: August 07, 2010 10:26PM

I finally got this to work and I appreciate this fine fix.

Those screenshots are a great way to verify also, so thanks, disrupted.



Edited 2 time(s). Last edit at 08/08/2010 04:00AM by Mister M.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.