Project

Profile

Help

Bug #1869

Infinite recursion (stack overflow) converting value to Javascript object

Added by Michael Kay over 2 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2013-08-26
Due date:
% Done:

0%

Spent time:
-
Found in version:
1.1
Fixed in version:

Description

When a node in a temporary tree is passed to an external function (in this case ixsl:set-property) the routine IXSLFunction.convertToJavascript() is called to convert it to a Javascript object. This appears to cause infinite recursion.

I haven't worked out exactly what is happening, but the logic appears to be flawed.

I suspect that the ValueRepresentation being passed is a NodeInfo that is not an HTMLNodeWrapper (specifically, it is a node in a LinkedTree). If this is the case, the logic will fall through to calling convertSequenceToArray, which will get the first item in the sequence (the original NodeInfo), and call convertToJavascript() passing this NodeInfo - which is an infinite recursion.

History

#1 Updated by Michael Kay over 2 years ago

Note that the code would appear to fail in the same way in other cases where the XDM value doesn't have an obvious representation as a JavaScript object - for example an atomic value of type xs:date.

#2 Updated by Michael Kay over 2 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from O'Neil Delpratt to Michael Kay

I have committed a patch to github. The effect of the patch is that this case now fails cleanly, saying the node cannot be converted to a Javascript object. I have also added a section to the documentation explaining the conversion rules between XPath and Javascript values.

Also available in: Atom PDF