Subj : API.File method execution problem using spidermonkey To : netscape.public.mozilla.jseng From : Matthew Mondor Date : Tue Feb 01 2005 06:10 am Hi all, Lately having some more time to play with spidermonkey, I tried a test, although am getting some problems. Basically, an API class is created which exposes a simple print method, which itself has an attached File class. The API class methods and properties are working fine, the problem is related to the File one. The API.File constructor can be used properly to create a new File object, and the new objects properties are working fine. However, the object's methods refuse to work (currently a simple test() method requireing no arguments). Whenever an attempt is made to call that method, the script execution is immediately interrupted, without an exception being catchable by the script. I used jsfile.c as an example a bit to try to see what could be wrong, but could not find out so far. Is there anything special test.c must do when calling js_InitFileClass(), or that this later function, or file_constructor(), must do to allow the test() method to work? I also wonder about another issue, I used as a test a check to verify if the constructor could be obtained from the class after it gets initialized, similarily to how jsfile.c in spidermonkey does to use it later on (although as it's only a test I don't use the value, but only verify if I succeed in obtaining it). It seems that without creating an object, if I only initialize the class, JS_GetConstructor() fails. I then started to wonder, if I have to perform anything special like creating an object before calling js_InitFileClass() in my js_file.c, perhaps this would also be the cause of my test() method not working. Since it's at a second level, not attached to the global object, but to the API class... The test source can be obtained using: cvs -z3 -d:pserver:anoncvs@cvs.pulsar-zone.net:/cvsroot co mmondor/tests/js-test (cvsweb http frontend also available through http://cvs.pulsar-zone.net) README file explains the problem, how to build the source and src/test.c is the code invoking js_InitFileClass(), which in turn resides in src/classes/js_file.c. js/test2.js is the current test script creating a File object and trying to invoke its test() method afterwards. Thanks in advance for any hints, Matt .