Since xmpp4moz uses a lot of handlers or objects being passed around, I
was wondering if anyone else has encountered Firefox occasionally
apparently forgetting variables which were in its scope at the time of
function definition? I'm not encountering this in xmpp4moz now, but
thought I'd ask here before fishing around Firefox lists, since I'd
imagine users here might have encountered this...
Do object references (as opposed to copies) ever "expire" if they are
passed around too much (e.g., if called/applied in a different 'this'
scope)? I really don't think I'm making copies so I don't see how this
information could get lost, and I have seen this work a lot of the time,
but it periodically does give me errors about such variables being
undefined...
For example, I'm adding observers like:
var debug = function (m) {alert(m);};
obj.addObservers({
action1 : function () {
debug('warning'); // Debug should be in scope but I sometimes
get errors saying debug is undefined
}
action2 : function () {
debug('warning 2');
}
});
(Btw, addObservers() in addition to storing the functions in arrays
according to the action topic name, will also keep a reference to the
notifying object so that the specific observer functions will later be
run in that object's scope. Does my problem possibly have anything to do
with references being what I have seen called "weak", and if so, how
might I overcome them being treated this way?)
thanks,
Brett