Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get all function-object properties from within jsd.enumerateScripts

46 views
Skip to first unread message

Jan Honza Odvarko

unread,
Aug 22, 2011, 8:44:32 AM8/22/11
to
In Firebug, I am trying to list all function object properties
(defined on a page) when enumerating all scripts by
jsd.enumerateScripts (jsd activated).

Here is roughly what I am doing in the extension (tested with Firefox
nigthly and Firefox 6)

jsd.enumerateScripts(
{
enumerateScript: function(script)
{
var func = script.functionObject;
var props = self.getProperties(func);
sysout(props.join(", "));
}
});

getProperties: function(scope)
{
var props = [];
var listValue = {value: null}, lengthValue = {value: 0};
scope.getProperties(listValue, lengthValue);

for (var i=0; i<lengthValue.value; ++i)
{
var prop = listValue.value[i];
var name = prop.name.getWrappedValue();
props.push(name);
}
return props;
},

My Test page:

<script type="text/javascript">

var myFunction = function(msg)
{
console.log("Hello");
}

myFunction.myProperty = "My Test Function";

</script>

---

All I am getting for myFunction object is:
caller, arguments, name, length, prototype

There is no "myProperty"

---

Note that it works in cases where Firebug debugger is halted at a
breakpoint and frame.script is used.

Is there anything wrong with the approach I am taking or it rather
sounds like a bug?

Honza


dro...@gmail.com

unread,
Feb 7, 2012, 9:36:00 AM2/7/12
to
I'm not sure but maybe this could help:
https://bugzilla.mozilla.org/show_bug.cgi?id=631742
0 new messages