Project

Profile

Help

Bug #3470

closed

SaxonJS 1.0.1 fails when calling the key() function; SaxonJS 1.0.0 works well

Added by Pieter Masereeuw about 7 years ago. Updated about 7 years ago.

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

100%

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

Description

SaxonJS 1.0.1 stops with a message in the console when the key() function is called. My impression is that this happens during key initalization - it looks like if a null "flags" object is being dereferenced.

The message is:

Uncaught TypeError: Cannot read property 'indexOf' of null

I add a very small set of files that reproduces the problem. Use the html-file, click the button and watch the console.


Files

saxonjskeytest.zip (611 KB) saxonjskeytest.zip Pieter Masereeuw, 2017-10-05 10:51
Actions #1

Updated by Debbie Lockett about 7 years ago

  • Assignee set to Debbie Lockett
  • Priority changed from Low to Normal
  • Applies to JS Branch 1.0 added

Thanks for logging this Pieter, and producing the small example to reproduce the problem. There were some changes in the implementation of the key() function between releases 1.0.0 and 1.0.1 which have produced this bug. Should be straightforward to resolve!

Actions #2

Updated by Pieter Masereeuw about 7 years ago

  • Company set to Pieter Masereeuw
  • Contact person set to Pieter Masereeuw

Yes, it took me some time to find the spot in my real application, but

after that, the error was surprisingly easy to reproduce.

Good luck!

Pieter

On 10/05/2017 11:32 AM, Saxonica Developer Community wrote:

Actions #3

Updated by Debbie Lockett about 7 years ago

  • Status changed from New to Resolved
  • Applies to JS Branch deleted (Trunk)
  • Fix Committed on JS Branch 1.0 added

The SEF supplied is generated using 9.7.0.19. Note that the bug is not produced when using an SEF generated by 9.8.0.4.

The Saxon-JS code changes between 1.0.0 and 1.0.1 were generally to handle changes in the SEF as produced by Saxon-EE 9.8 rather than 9.7. But unfortunately this bug slipped in causing the problem for 9.7 SEFs.

The problem is with the flags variable. The fix is to first check that there is actually a flags attribute on the declaration in the SEF, and if not, default to "" (rather than null, so that the subsequent flags.indexOf() call is OK). So:

var flags = keyDecl.getAttribute("flags");

is replaced by

var flags = keyDecl.hasAttribute("flags") ? keyDecl.getAttribute("flags") : "";

Fix committed on 1.0 branch. (The bug is not found in the trunk branch, due to other code improvements, e.g. the above check is already happening.)

Actions #4

Updated by Debbie Lockett about 7 years ago

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

Bug fix applied in Saxon-JS 1.0.2 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page