Subj : JS_GetScriptLineExtent returns bad number To : netscape.public.mozilla.jseng From : Mike Moening Date : Wed Mar 23 2005 05:38 pm It appears the JS_GetScriptLineExtent function returns the wrong extent inside a NewScript hook. The hook is called 4 times (once for each 3 functions and once for the entire script). It seems the extent returned is several lines short... Heres what is returned: Call# Function StartLine Extent ----------------------------------------------- 1 fact 1 4 (should be 6) 2 WONKA 9 4 (should be 6) 3 WILLY 15 4 (should be 6) 4 null 0 16 (should be 20) Even though the "WILLY" function is not actually called why doesn't the extent reflect its precence? Also why does the startline passed to the hook have the value of 1 for the "fact" function instead of 0 like the main script? Something is weird here... (probably my understanding) Thanks for the help! The javascript code is below. Please note the line number comments. ------------------------------------------- function fact(n) /* line 1 */ { if (n <= 1) return 1; return n * fact(n-1) } fact(5); /* line 7 */ WONKA(4); function WONKA(n) /* line 9 */ { if (n <= 1) return 1; return n * fact(n-1) } function WILLY(n) /* line 15 */ { if (n <= 1) return 1; return n * fact(n-1)\n" \ } /* line 20 */ .