[Greasemonkey] Inspecting / Modifying global in-page variables in 0.6

Gareth Andrew freega at freegarethandrew.org
Thu Sep 15 18:26:09 EDT 2005


Anthony,

This doesn't appear to be a greasemonkey problem, unsafeWindow should
behave exactly as window does in regular javascript.  It seems to be a
firefox 1.5 bug/feature.  The bug can be seen in the attached html page
without using Greasemonkey.  
Sorry this doesn't actually help solve your problem, but i've got my
thinking cap on.  Le us know if you solve this problem via another
avenue as I'm sure it would be of interest to other script developers.

Gareth.



On Thu, 2005-09-15 at 09:07 -0500, Jeremy Dunck wrote:
> On 9/15/05, Anthony Lieuallen <arantius at gmail.com> wrote:
> > On 9/14/05, Aaron Boodman <zboogs at gmail.com> wrote:
> > > Wow, there really should be no difference at all. Could it be that you
> > > arent declaring the 'val' variable?
> > 
> > No, adding the line "var val;" to the top of the user script does not
> > help.  Adding "dump(key+'\n');" directly inside the for loop shows the
> > "myval" key is never iterated.
> 
> D'oh.
> 
> >From the wiki page:
> 
> "
> You cannot iterate over HTMLCollections with an "in" statement. Consider 
> 
> var arInputs = document.getElementsByTagName('input'); 
> for (var elmInput in arInputs) { ... } 
> 
> This no longer works in Deer Park, because arInputs is an
> XPCNativeWrapper of an HTMLCollection, and you can't iterate through
> an XPCNativeWrapper with an "in" statement. Instead, you need to do
> this:
> var arInputs = document.getElementsByTagName('input'); 
> var elmInput; for (var i = 0; elmInput = arInputs[i]; i++) { ... } 
> "
> 
> I realize unsafeWindow isn't an HTMLCollection, but perhaps the
> problem is wider than that...
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
-------------- next part --------------



More information about the Greasemonkey mailing list