After much logging, I've found the hang.  It's a recursion loop,
one which seems to be occuring because, somehow, on Google News pages,
there seems to be a DOM of infinite depth.  Here's the code,
which recurses down child nodes to see if there's an LI element
somewhere in the subtree:

function containsblockelt(elt, depth)
{   if (elt === null) return(false);
    var kcontainmax = 20;
    if (depth > kcontainmax)
{ throw("Containsblockelt error: recursion limit reached on " + elt); /// ***TEMP***
        return(false);                                  // fail
    }
    if (elt.nodeType != 1) { return(false); }  // must be ELEMENT_NODE
    var eltname = elt.nodeName.toUpperCase();           // "DIV", etc.
    if (eltname == "LI") return(true)                   // ***TEMP***
    if (elt.childNodes === null) { return(false); }     // no children
    for (var i=0; i < elt.childNodes.length; i++)   // for all children
    {    if (containsblockelt(elt.childNodes[i], depth+1))
        { return(true); }    // recurse down tree
    }
    return(false);              // found no block elt
}

   On Google News pages, and only on Google News pages, this will hit
the recursion depth limit and throw an exception.

   The tree being examined is supposed to be the DOM, but it's
actually objects that display as [object XRayWrapper [object HTMLDivElement]]. My code starts by finding A elements, which
works fine.  Then it looks outward in the DOM, using elt.parentNode, to
find the enclosing DIV, then looks inward again for some checks.  On
a tree structure, this works fine.  But somehow the XRayWrapper,
and something that happens on Google News pages, results in a loop
that the recursive code above chases endlessly, or did until I put
in a recursion limit.

XRayWrapper transparency may be broken at some point.  There have
been other problems in that area:

https://forums.mozilla.org/addons/viewtopic.php?p=9092&sid=3cad4146ddf42ab4facf301aaed03ac5

http://code.google.com/p/fbug/issues/detail?id=4375

http://userscripts.org/scripts/show/86914

I suspect some problem with XRayWrapper is causing my problems.
Comments?

                                John Nagle

--
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to