Project

Profile

Help

Bug #3501

closed

Error when object supplied to ixsl:get() is null

Added by Debbie Lockett about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2017-10-27
Due date:
% Done:

100%

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

Description

If ixsl:get() is called on an object which is null, this throws a JavaScript TypeError e.g. "TypeError: Cannot read property 'localName' of null". This error should be handled better by Saxon-JS to produce an XError with a more informative message.

Note that if ixsl:call() is called on an object which is null, then this produces a decent XError because it fails a cardinality check: "Required cardinality of first argument of ixsl:call() is exactly one; supplied value is empty at test.xsl#15".

Actions #1

Updated by Debbie Lockett about 7 years ago

Similarly, when a node supplied to ixsl:style() is not found, we currently get a JavaScript TypeError:

"Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'."

Actions #2

Updated by Debbie Lockett about 7 years ago

  • Subject changed from Improve error message when object supplied to ixsl:get() is null to Error when object supplied to ixsl:get() is null
  • Status changed from New to In Progress

We decided that actually, if an empty sequence (JavaScript null object) is supplied as the first argument to ixsl:get(), then we should return an empty sequence, rather than producing an error.

Note that this ensures that (as the documentation states): "ixsl:get($object, "prop") and $object?prop are interchangeable". i.e. these give the same results, including the case when $object is null.

Similarly, if the argument supplied to ixsl:style() is not an Element (i.e. if it is null, or some other object), then we should return an empty map.

Fixes committed on 1.0 and trunk branches.

A number of JS unit tests have been added: ixsl/getEmpty01 - 04, ixsl/styleEmpty01, ixslErr/callErr03.

The documentation needs to be updated to clarify these cases.

Actions #3

Updated by Debbie Lockett about 7 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 1.0, Trunk added

Documentation updated.

I have made these changes in the online documentation - to add further details/clarification for how the functions should work, even though bugs like this one remain for now.

Actions #4

Updated by Debbie Lockett over 6 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 1.1.0

Bug fix applied in the Saxon-JS 1.1.0 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page