[Jslib] Include Paths

Gordan Bobic gordan at bobich.net
Wed May 30 05:41:04 PDT 2007


On Wed, 30 May 2007, Pete Collins wrote:

> >I'm trying to use jslib in XPCShell. I'm trying to write a CGI application 
> >using it. The problem I have is that it only seems to work from the 
> >directory where xpcshell is installed (e.g. /usr/local/lib/firefox-1.0.8).
> >
> >>From there, I can do:
> >
> >$ ./xpcshell
> >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> >xpcShell loading ... chrome/jslib/debug/debug.js
> >xpcShell loading ... chrome/jslib/modules.js
> >js>
> >
> >But from anywhere else, I get:
> >
> >$ /usr/local/lib/firefox-1.0.8/xpcshell
> >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> >xpcShell loading ... chrome/jslib/debug/debug.js
> >/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js:224: can't open 
> >chrome/jslib/debug/debug.js: No such file or directory
> >js>
> >
> >Can anyone suggest a way to work around this? Is there a default include 
> >path that can be specified, either in the environment or on the xpcshell 
> >command line? Would this necessitate putting a code hack into jslib.js to 
> >check the environment and set the base include path?
> >
> >
> >  
> >
> Yes, you'll have to load each individual jsLib file using load:
> 
> const pre = "/usr/local/lib/firefox-1.0.8"
> 
> load(pre+"/chrome/jslib/debug/debug.js");

Yes, but that doesn't suppress the warnings. Either way, I made a change 
to jslib.js to check for the default path in the environment and use that 
instead of the chrome:// path. That fixes it nicely. :-)

On a separate but related note:
It would seem that xpcshell segfaults when run in the Apache CGI mode, but 
the same script works as expected from the command line. I checked all the 
obvious things like permissions (if I run it as the apache user, it still 
works fine), so it seems that it's something in the Apache environment 
that seems to trigger it.

Has anyone come across this before, or have any ideas where to look?

Gordan



More information about the Jslib mailing list