Benjamin Smedberg wrote:

I am posting this to npm.xpcom, so feel free to reply there or by email directly... this isn't quite ready for a bug report, because I don't know what the API might look like.

I have recently encountered the need for something like a directoryservice or categorymanager that can return ordered lists of files/directories, but which can be dynamically updated at runtime. Here are a couple use-cases:

Both the prefs engine and the chrome registry should register default prefs/chrome lists from the GRE and the application... in addition, various extensions need to install chrome and default prefs.


hmm... so why wouldn't each of these components simply load files from the GRE first before the loading them from the application? inotherwords, why not make the GRE explicit?



My original thought was to use a category "default-prefs" with entries pointing to file paths. Unfortunately, default prefs need to be read in an ordered way: GRE -> application -> extensions and the category manager can't do ordered lists.


this ordering sounds like something that should just be hardcoded into the pref service.



My next thought was to use the directoryservice. This provides an ordered list (through directoryservice2.getFiles) but it does not allow the various pieces (GRE/application/extensions) to *add* paths to the list... only *replace* the list through a new directoryserviceprovider entry. In addition, it is not persistent... extensions would need to register a directoryserviceprovider.


the ability for extensions to hook into the chain of directories does seem important. however, does order really matter for extensions? can you give concrete examples of extensions that would need special ordering with respect to other extensions?

prefs currently use an alphanumeric-based naming convention to determine the order with which individual pref files are loaded. couldn't we invent a special prefix (possibly involving numbers) for pref files to ensure proper ordering? seems like chrome files could employ a similar scheme if necessary.



So I am pondering something like a "orderedcategorymanager", but I'm having trouble designing it... do you have suggestions for an interface that does what I have outlined?


i think you need to give more examples. i'm having a hard time understanding why this is needed.

thanks!
darin




Reply via email to