String bundle cache should be cleared if a restartless extension updates

RESOLVED DUPLICATE of bug 918033

Status

()

Core
Localization
RESOLVED DUPLICATE of bug 918033
6 years ago
3 years ago

People

(Reporter: Wladimir Palant (for Adblock Plus info Cc bugzilla@adblockplus.org), Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

The results of nsIStringBundleService.createBundle() are cached which is generally a good thing. However, if a restartless extension updates mid-session and its strings change - this cache isn't cleared and the extension gets the old version of its strings. In the best case scenario old strings will be displayed, worst case is extension breakage because new strings simply aren't present in the new string bundle.

My current workaround is adding "?" + Math.random() to the end of the string bundle URL to make sure it is loaded each time (this is combined with an own caching approach of course). This seems suboptimal however.
Looks like just moving the notifications sent here http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/XPIProvider.jsm#1598 into flushStartupCache should do the trick, I don't remember if there are any adverse effects to doing those during runtime though.
Any movement on this?
Actually I just checked Firefox 18.0.2 and the nightly loads and this doesn't seem to be a problem.

All that's required is to do a nsIStringBundleService.flushBundles() to flush the cache and the new strings are loaded the next time a call to nsIStringBundleService.createBundle() is called.  

So doing a flushBundles() in the bootstrap shutdown function seems to work fine as far as I can tell.
Even then, this is something that the extension manager should do - extensions shouldn't need to flush global caches.

Updated

4 years ago
See Also: → bug 1051238
Marking this a duplicate of bug 918033 only because that bug has working and more comprehensive examples attached to verify the issue.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 918033
You need to log in before you can comment on or make changes to this bug.