Subj : Strange problems with function objects & event listeners To : netscape.public.mozilla.jseng,netscape.public.dev.xul From : Lev Serebryakov Date : Tue Sep 27 2005 06:43 am Hello! I have such code in my JavaScript file, included into XUL overlay: function myext_initUI( event ) { // Some code without any errors window.dump( "[myext] Init finished without exceptions\n" ); } window.addEventListener( "load", myext_initUI, false ); // EOF It works. Event listener is called, my UI-initialization tasks complete, and very last line of function write line into console without errors. But "Google Toolbar" extension doesn't work with my one! Investigation shows, that NO MORE "load" LISTENERS ARE CALLED AFTER MY ONE! Ok, I've found workaround: function myext_initUI( event ) { // Some code without any errors window.dump( "[myext] Init finished without exceptions\n" ); } window.addEventListener( "load", function( evt ) { myext_initUI(evt); }, false ); // EOF And it WORKS! But WHY first variant cause such strnage behavior WITHOUT any error messages or exceptions, dumped into console and/or JavaScript console?! IMHO, there is NO need in anonymous function, because "myext_initUI" is legal object of type "Function" and can be used in such places! Even more: typeof(function( evt ) { myext_initUI(evt); }) == typeof(myext_initUI) so it seems, that I am right. Is it my bug or bug in XUL/SpiderMonkey/XPCOM? -- // Lev Serebryakov .