[Jslib] jslib not loading properly

Gerry Kavanagh gerryk at kaltel.com
Tue Jan 20 11:55:09 EST 2004


I'm having difficulty in getting the basic functions of JSLib working. 
The following is a simple script I'm using to test file IO.

I've tried it on Mozilla 1.4, 1.5 and Firebird 0.7 with the current 
JSLib jar installed as system wide and profile only with no joy.

The error I'm getting is:

Error: File is not defined
Source File: file:///opt/mozilla/chrome/jslib_test.xul
Line: 17

The reason I've used the full filespec instead of jslib_file is that 
jslib_file is undefined also.

Error: jslib_file is not defined
Source File: file:///opt/mozilla/chrome/jslib_test.xul
Line: 12


<?xml version="1.0"?>
<!DOCTYPE window>

<window
    id="jslib-test"
    style="background-color: #cccccc; width: 100px; height: 100px;"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >

<script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js"/>;
<script type="application/x-javascript">
   include ('chrome://jslib/content/io/file.js');
   // var fu = new FileUtils();

   function writeLog( sText ) {
      var f=new File( '/home/kaltelkiosk/kiosk.log' );
      var now=new Date();
      var outString=now.toString() + ' - ' + sText;
      if ( f.exists() ) {
         f.open( 'w' );
      } else   {
         f.create();
         f.open( 'w' );
      }
      f.write( outString );
      f.close();
   }

</script>   

<vbox flex="1" pack="center">
    <spacer flex="1" />
    <button label="test" oncommand="writeLog('test log thing');" />
    <spacer flex="1" />
</vbox>
</window>



More information about the Jslib mailing list