At this time the narwhal-xulrunner engine only supports filesystem based
file paths. Not urls pointing to files in jar archives such as:
jar:file:///data/.../extensions/te...@test.com/packages.jar!/test/echo.js
I am eager to get this working but am stuck on how to test for, iterate
and read files from jar archives.
Any suggestions on how I should go about this?
Thanks!
Christoph
The files *are* mapped to a chrome URL using "resource://". Using
nsIChannel will work only for *reading* them.
The extension works with all files flat on the filesystem (as during
development). For distribution, extension files should be in jar
archives. narwhal-xulrunner should handle this underlying change
transparently. This is not the case right now as it uses full filesystem
paths to read modules.
If we access all narwhal modules via "resource://narwhal/..." and all
program modules via another resource URL we can make this automatic I think.
A resource URL if mapped to a jar file will convert to:
jar:file:///data/.../extensions/te...@test.com/packages.jar!/test/echo.js
This provides all info we need to use nsIZipReader to check if a file
exists, iterate directories and read.
I am wondering if nsIZipReader is the best solution for this. I was
hoping to tie into the same interface used internally when xulrunner
services chrome URL's from jar files to make this most efficient.
I do think we may need to add this to the IO layer (to provide
abstraction) but in a *read only* mode since the jar files are static.
Christoph
>
> [1]: http://forums.mozillazine.org/viewtopic.php?p=921150#921150
>
> On Fri, Nov 6, 2009 at 12:27 AM, Christoph Dorn
> <christ...@christophdorn.com <mailto:christ...@christophdorn.com>>
> wrote:
>
> I am going through the motions of bundling a narwhal-based firefox
> extension and have run into a roadblock: Extension files packed into jar
> files.
>
> At this time the narwhal-xulrunner engine only supports filesystem based
> file paths. Not urls pointing to files in jar archives such as:
>
> jar:file:///data/.../extensions/te...@test.com/packages.jar!/test/echo.js
> <http://te...@test.com/packages.jar%21/test/echo.js>
Yes, Jars are zips.
> As you're aware, currently the Narwhal loaders are all based on the
> filesystem. A module must be in the filesystem in one of the search
> paths. We need to add hooks to allow a loader to provide "virtual"
> search paths (for lack of a better term), which map module ids to
> module factories. This will allow things like modules compiled into
> the binary, zips, jars, etc.
Ah yes. That makes sense.
Any volunteers to add hooks for "virtual" search paths and a sample zip
loader [1]? I have too much on my plate :(
Christoph