Benjamin Smedberg wrote:

On 8/20/2012 9:25 AM, sebastiang...@gmail.com wrote:

Am Dienstag, 1. Februar 2011 06:16:50 UTC+1 schrieb johnjbarton:

I recall reading some rumors about Components.utils.import being cached in such a way that devs can't change the source and see changes. Any truth to this? Any workaround if true? (Other than the rumored requirement to change the file names!).

I can confirm this issue: Using Firefox 14.01 and using utils.import to load user scripts from the Firefox profile directory does not work as expected: Changes to the imported files do not take effect after a Firefox restart. I also tried unload without success:

Components.utils.unload("file://" + filePath);
Components.utils.import("file://" + filePath);

However, sometimes (I cannot reproduce when exactly) after several restarts Firefox seems to drop the cache and read the file again. I'm curious for any workaround. It would be cool to reimport a modified file without a restart.

This is a function of the "startup cache" which improves startup performance by cacheing preparsed versions of these files the first time they are parsed to improve future startup times. The startup cache is automatically cleared when Firefox updates to a new version, when the user launches in safe mode, and I believe whenever a non-restartless addon is installed or uninstalled. You can programmatically clear the startup cache using the nsIStartupCache.invalidate() interface; you can also do some other things:

* Use the -purgecaches command line argument or MOZ_PURGE_CACHES=1 environment variable to clear on startup. * set the MOZ_STARTUP_CACHE=/path/to/file environment variable to change what file Firefox uses for the startup cache

The rot seems to have crept into chrome scripts as well. Time was that you could disable the XUL cache and your DTD and JS files would get re-read too. Now that I have looked I see that Services.obs.notifyObservers(null, "startupcache-invalidate", null); will help me out a bit.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to