[Jslib] Re: xpcshell weirdness w/ 1.4RC1?

Pete Collins pete@mozdev.org
Tue, 10 Jun 2003 16:04:08 -0400


I just had a chance to look at this. I seems that using object getters 
and setters in xpcshell don't work any more.


Look at this sample.


js> function foo () {}
js> foo.prototype = {
pete:'hey',
get path () { return '/tmp/pete'; }
}
[object Object]
js> var p = new foo();
js> p.path;
js> p.pete;
hey
js> print(p.path);
js>


If you notice, the getter path doesn't work and it should.


--pete



Chad House wrote:
> Has anyone had problems with jslib running under the xpcshell from
> 1.4rc1? Some of the basic examples with the jslib File API don't
> return anything for read-only attributes like size or path.
> 
> I tested with a jslib build from CVS pulled today (version 0.1.65),
> the current tarball from jslib.mozdev.org (v. 0.1.64), and an older
> copy (v. 0.1.53).
> 
> Here's a sample session. The file /tmp/foo exists and contains only
> the word 'blah'. Everything works fine, except for the read-only
> attributes (at end of listing):
> 
> | $ xpcshell
> | js> load('jslib.js');
> | 
> | Welcome to jslib version 0.1.64
> | 
> | Global Constants:
> | 
> | JS_LIBRARY     
> | 	jslib
> | JS_LIB_FILE    
> | 	jslib.js
> | JS_LIB_PATH    
> | 	chrome://jslib/content/
> | JS_LIB_VERSION 
> | 	0.1.64
> | JS_LIB_AUTHORS 
> | 	Pete Collins       <petejc@mozdevgroup.com>
> | 	Eric Plaster       <plaster@urbanrage.com>
> | 	Martin.T.Kutschker <Martin.T.Kutschker@blackbox.net>
> | JS_LIB_BUILD   
> | 	mozilla 1.3+
> | JS_LIB_ABOUT   
> | 	This is an effort to provide a fully functional js library
> | 	for mozilla package authors to use in their applications
> | JS_LIB_HOME    
> | 	http://jslib.mozdev.org/
> | 
> | Global Variables:
> | 
> |   JS_LIB_DEBUG
> |   JS_LIB_ERROR
> | 
> | *********************
> | JS_LIB DEBUG IS ON
> | *********************
> | 
> | js> include(jslib_file);
> | *** load: filesystem.js OK
> | *** load: file.js OK
> | 0
> | js> var f = new File('/tmp/foo');
> | js> f.exists();
> | true
> | js> f.open('r');
> | true
> | js> f.read();
> | blah
> | js> f.size
> | js> f.path