[Jslib] Re: Problem with jslib install on Mac OS X

Eric de la Musse edlm10@pobox.com
Mon, 21 Apr 2003 14:37:25 +0200


Pete Collins wrote:

> Ok, jsliib is installed and working fine, it appears the new splash code 
> is causing Mozila to crash on MacOSX.
> 
> I'll file a bug on this.
> 
> In the meantime, you can use jslib, also to test you can do this:
> 
>   ./mozilla-bin -chrome chrome://jslib/content/splash.xul

Yes, this url works fine (the splash screen appear) but why the code 
below doesn't work ("File is not defined" in the Javascript console)?

<?xml version="1.0"?>

<window 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" 
src="chrome://jslib/content/io/file.js" />
<script>
	function test()	{
		var f=new File("/Users/eric/Desktop/dummy.txt");
		alert(f.exists());
	}
</script>
<button label="test" oncommand="test();"/>
</window>

and this ("uncaught exception:Permission denied to create wrapper for 
object")

<?xml version="1.0"?>

<window 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js" />
<script>
	function test()	{
		include("chrome://jslib/content/io/file.js");
		var f=new File("/Users/eric/Desktop/dummy.txt");
		alert(f.exists());
	}
</script>
<button label="test" oncommand="test();"/>
</window>

and adding 
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
return another "File is not defined"

<?xml version="1.0"?>

<window 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js" />
<script>
	function test()	{
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		include("chrome://jslib/content/io/file.js");
		var f=new File("/Users/eric/Desktop/dummy.txt");
		alert(f.exists());
	}
</script>
<button label="test" oncommand="test();"/>
</window>

Thank you for your help

-- 
Éric de la Musse