Re: Partial solution to debugging eval() code

"John J. Barton" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
timeless wrote:
> John J. Barton wrote:
>> All jsd "scripts" are one of four types: (or so I think)
>>   top-level
>>   eval-level
>>   functions defined in top-level   << no problem
>>   functions defined in eval-level  << problem
> ...
>> Actually a fifth one has appeared:  event scripts like onclick
>> for lines like
>>         <a onclick="doHi();">I'll say if you do.</a>
>> These come in as scripts on line 1 of the HTML file, apparently
>> generated by the browser.  Don't cause problem with the
>> eval() detector, so its more a question of supporting them in
>> the debugger.
> 
> I'm asleep, but I believe the following is correct:
> 
> the sixth is:
> 
> <a
> id=foo><script>document.getElementById("foo").setAttribute("onclick","foo()")</
> a>
> 
> note that onclick and friends are compiled each time they're triggered
> (for more fun, check out xbl!).
> 
Thanks, looks like this case and the onclick attribute end up looking 
the same by the time they get to onScriptCreated.  Your case followed mine:

onScriptCreated: 
1-2@http://localhost:63636/.fireclipse.eclipse.workspace/DynLoadTest/WebContent/TimelessLinkedScript.html
onScriptCreated: onclick
     function onclick(event) {
         foo();
     }
onScriptCreated: 
1-2@http://localhost:63636/.fireclipse.eclipse.workspace/DynLoadTest/WebContent/JavaScriptInTags.html
onScriptCreated: onclick
     function onclick(event) {
         doHi();
     }

I guess my heuristic is
   "! (from .js file) && (after top_level for that file)"
I think venkman calls "after top_level" "sealed".  Maybe
the last test is enough.

(Firebug doesn't deal with XUL so far, so I'll pass on xbl ;-).

John.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.