Project

Profile

Help

Bug #5046

closed

Handling null and undefined objects in ixsl:get() and ixsl:set-property

Added by Debbie Lockett over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
IXSL extensions
Sprint/Milestone:
-
Start date:
2021-07-22
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
2
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

(Having already spent lots of time working on this, it's time to try to get the issues in writing.)

We need to clarify how null and undefined JavaScript objects are handled within ixsl:get() and ixsl:set-property. Both the code and documentation need work.

Currently the documentation for ixsl:get() says:

If the specified object or property does not exist, then the function returns the empty sequence (with a console log warning in the latter case). (Note the difference to the similar function ixsl:call(), for which a run-time error is raised in this case.)

While for ixsl:set-property:

An error will be raised at run-time if the specified object does not exist or is not unique. If the specified property does not exist, then there is no error, but a warning is output in the console log.

Note that the property name string supplied to ixsl:get() and ixsl:set-property can be a dot separated list of names to access a nested property; but we are not clear about what happens when we encounter null or undefined objects in such a nested chain of objects.

For instance consider ixsl:get($object, 'a.b.c') and <ixsl:set-property object="$object" name="a.b.c" select="'value'"/>. What happens if in JavaScript $object.a or $object.a.b returns null or undefined? Currently if either of these is null, Saxon-JS 2.2 crashes with an uncaught TypeError, so there is definitely a bug here.

Please register to edit this issue

Also available in: Atom PDF Tracking page