[Jslib] 'include' isn't known in FF for me

Frank Burleigh burleigh at indiana.edu
Sat Sep 18 13:49:14 EDT 2004


Pete Collins wrote:
> 
>>
>> - In moz, I was able to create a file (root of c:) but using write() 
>> would fail every time--with the js console I'd see an exception the 
>> exact text of which I don't have access to now--
> 
> 
> 
> Yea, I need a test cast to see what is failing.
> 
> Without filing a bug, it's hard to fix. We need OS, and steps to reproduce.
> 
> Thanks
> 
> --pete
> 

Hi Pete.  I don't have the conditions I had when I first went at this -- 
not even the original code.  I've duplicated something close to it below 
and find it working in Mozilla (but not in fox, likely because fox knows 
nothing of the xul file, as was said yesterday).  It could be that when 
I switched to another method I may have created the conditions for this 
code to behave.  The other method started with:

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

which Moz will now remember.  If I knew how to retract this priv, I 
could try again.  (Changing this to *disable* on a lark didn't seem to 
change anything; and if it did, we're in trouble because Moz is happily 
writing to my hard drive with no chrome protocol, no "registration" of 
the app, or anything else.)

<?xml version="1.0"?>

<window
     id="mywindow"
     title="Find Files"
     orient="horizontal"
     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">
<![CDATA[	
     include (jslib_file);

     function postData( sName, sId, sEmail )
     {
         var sPath="c:\\forum.txt";

         var f=checkFileExists( sPath );
         if( f )
         {
             f.open( "a" );
             f.write( "a line of text\n" );
             f.close();
         }
     }

     function checkFileExists( sPath )
     {
         var f=new File( sPath );

         if( f && f.exists()==false )
             f.create();

         return f;
     }

     postData();

]]>	
</script>

</window>


More information about the Jslib mailing list