Closed GoogleCodeExporter closed 9 years ago
The problem seems to be what we get back from childNodes.
this works:
javascript:alert(Array.prototype.slice.call(new Array("one", "two"), 1)) // two
javascript:alert(new Array("one", "two").slice(1)) // two
javascript:alert(window.document.documentElement.childNodes) // object NodeList
javascript:alert(window.document.documentElement.childNodes[0]) // object
HTMLHeadElement
this doesn't:
javascript:alert(window.document.documentElement.childNodes.slice(0)) // should
be
also HTMLHeadElement, but is undefined
The expression succeeds, but doesn't actually work. In "full" we go on to try to
reference the Array we are expecting to get, but don't, hence the exception.
Original comment by classi...@floodgap.com
on 17 May 2010 at 5:42
JavaScript in 9.1 returns a sliced object for
Array.prototype.slice.call(s.documentElement.childNodes,0) and 9.2-internal
doesn't.
We probably need to relax some checks in jsarray.c and add compiler warnings to
back
them out later.
Original comment by classi...@floodgap.com
on 17 May 2010 at 10:06
It appears our version of the DOM does not use property tags in the way
SpiderMonkey
expects. This fixes the problem, in jsarray.c::GetArrayElement:
if (!prop) {
// Classilla issue 118
#if(0)
*hole = JS_TRUE;
*vp = JSVAL_VOID;
goto out;
#else
#warning !!!KLUDGE ALERT!!! we are handling properties a la old JavaScript
// We don't drop the property -- there's no property to drop.
goto gimmeprop;
#endif
// end issue
}
OBJ_DROP_PROPERTY(cx, obj2, prop);
gimmeprop:
if (!OBJ_GET_PROPERTY(cx, obj, id, vp)) {
This is clearly a kludgy solution, but it seems to be perfectly stable, and
sites now
work extremely well.
Original comment by classi...@floodgap.com
on 17 May 2010 at 11:25
Original comment by classi...@floodgap.com
on 17 May 2010 at 11:26
Original issue reported on code.google.com by
classi...@floodgap.com
on 17 May 2010 at 6:47