G
gyrm
I'm trying to write a simple javascript profiler that works in IE and
other browsers. In order to get a list of functions to decorate with
profiling code, I intended to enumerate the properties of the window
object, figuring that any functions defined by the user in the global
scope would show up. This works in Firefox ... but doesn't in IE
(argh!). It appears that user-defined functions, when declared in the
typical way, are not enumerable using for..in . (Why is this? Has this
been / Is this going to be fixed?) Other posts seem to corroborate
this ... see references below.
I'm wondering if anyone can think of another way to enumerate global
functions in IE, using the window object or otherwise. What just
occurred to me was parsing <script> tags for strings that seem like
they might be function names, and just trying them against the window
object. This seems like a junky workaround and I'd appreciate other
suggestions if you have them!
Thanks!
Haw-Bin Chai
References:
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/0389b4dd213bc2a0
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/a0f3ffdff1869ded
http://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute
other browsers. In order to get a list of functions to decorate with
profiling code, I intended to enumerate the properties of the window
object, figuring that any functions defined by the user in the global
scope would show up. This works in Firefox ... but doesn't in IE
(argh!). It appears that user-defined functions, when declared in the
typical way, are not enumerable using for..in . (Why is this? Has this
been / Is this going to be fixed?) Other posts seem to corroborate
this ... see references below.
I'm wondering if anyone can think of another way to enumerate global
functions in IE, using the window object or otherwise. What just
occurred to me was parsing <script> tags for strings that seem like
they might be function names, and just trying them against the window
object. This seems like a junky workaround and I'd appreciate other
suggestions if you have them!
Thanks!
Haw-Bin Chai
References:
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/0389b4dd213bc2a0
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/a0f3ffdff1869ded
http://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute