default mime type program is inconsistent between system and the mozilla firefox/thunderbird?

Finally I figured it out: The Mozilla applications are going to look through list of files for mime-type-app associations in following order:

~/.local/share/applications/mimeapps.list
~/.local/share/applications/mimeinfo.cache
/usr/local/share/applications/mimeapps.list
/usr/local/share/applications/mimeinfo.cache
/usr/share/applications/mimeapps.list
/usr/share/applications/mimeinfo.cache
/usr/share/applications/defaults.list

Actually they should not use mimeinfo.cache at all. Because there is no order in these files. In some distro there will be default mimeapps.list which is nice. But many distros does not have default mimeapps.list. In some distro there is no mimeinfo.cache at all. Thus in these distros it falls back to /usr/share/applications/defaults.list which works fine. But in ubuntu, there are still mimeinfo.caches, which will be automatically generated after each updates. In kubuntu it is even worse, because the associations in defaults.list are specified to gnome apps but not KDE ones.

The good way to solve this is to generate my own mimeapps.list and put it into ~/.local/share/applications/.