I spent a few hours tonight debugging this in Eclipse, and it appears as though the issue is that methods like "descendants" do not show up as actual methods, and thus slots or properties, on the XML objects. Rather, XMLObjectImpl.execIdCall is called, which switches these methods and delegates them to methods on the native Java object. So, when the filter is called with, e.g. descendants, the scoping appears to be handled properly, which is to say that the object lookups are delegated to the prototype, which is the context XML node. So, you end up in hasXMLProperty, with xmlName argument set as "descendants". The lookup under getPropertyList fails, as it should, but then the lookup under getMethod(xmlName.localName()) fails, which it should not. The getMethod lookup fails because it delegates all the way up to ScriptableObject.getSlot, which fails to find a slot named "descendants". It seems the solution would be to expose these built-in XML methods as actual slots on the object, but I'm new to Rhino, and I'm not yet clear on what would be the best way to go about doing that.
Also, the patch I linked to in the summary does not work. Delegation does not appear to be the problem, which is what that patch aimed to solve.
Created attachment 432448 [details] [diff] [review] Another approach OK, my first attempt was clearly wrong. Here's another try. Basically, if nameOfFunction() looks for a method and it's ''with'' an XML object, we use the same semantics as ECMA-357 188.8.131.52 CallMethod to look up a suitable method. What do you think?
Martin, I've done some tests, and it's been working well for me. I think I'm going to try to use it in the project which I had originally intended it, and so I'll be able to report any bugs I find that might be caused by this patch. Great work, I hope it gets accepted upstream.
e4x support has been removed (bug 788293).
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
Again, what E4X removal from Spidermonkey to do with Rhino?
Sorry, I didn't see that this was about Rhino.
Status: RESOLVED → UNCONFIRMED
Resolution: WONTFIX → ---
You need to log in before you can comment on or make changes to this bug.