You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-dev@incubator.apache.org by Michael Turyn <MT...@nexaweb.com> on 2006/07/24 19:10:12 UTC

Debugging

 I've put in a method that lets the Venkman debugger for Mozilla see
files we're loading.

BACKGROUND:  Venkman "normally" knows where to look for code by hooking
into the Mozilla loading process when a <script/> tag is encountered,
e.g.:
	    <script language="JavaScript" type="text/javascript"
src="../../src/xap/Xap.js"></script>
....  Dojo, by contrast, grabs the entire source-file as a string via an
XMLHttpRequest, then eval()'s it---the debugger then doesn't understand
where the source comes from.  (Conceivably, one could arrange for
Venkman to be given this information directly, but it's not something
for which I've time...)


You're supposed to be able to allow debugging by changing a few Dojo
parameters, at which point dojo.require() will examine the file for
required additional files, and add it and them to a load list---it will
then later, when the user calls "dojo.writeIncludes()", write out (you
guessed it) a bunch of <script/> tags.  Nice, clean...doesn't seem to
work well within my time constraints.  Files remain unloaded, Dojo seems
to have a hard time finding its alternate require() code and the
writeInclude()...and it's hard to debug this.

Instead, now, before Xap.bootstrap() is called, you can specify a list
of files to be reloaded with <script/> tags for the debugger's sake
(using xap.util.Utils.importFile()).  Then, when you bootstrap, a second
parameter should be added, and the files will be reloaded.

A special case:  if that second parameter is "debugAll", then _any_ call
to Xap.require() will also reload with <script/>s, with the effect that
any of the classes we use will be brought in---this will probably slow
things down a lot, but might be necessary when looking for the source of
a problem.

(We don't do Dojo XOR <script/> loading because we use Dojo's [useful!]
dependency mechanism, so require()ing a single file can also trigger the
loading of a whole bunch of them; therefore we need to keep the
Dojo-based loading regardless.)

I hope this will make life easier for people working on this project, or
who might want to understand the code by stepping through it in a
debugger (that's how I seem to understand it best).