Project

Profile

Help

Bug #4611

XPath expression "function(){'x'}()" crashes with TypeError: this.closureContext.localVars.slice is not a function

Added by Michael Kay 3 months ago. Updated 3 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2020-06-25
Due date:
% Done:

0%

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

Description

Executing the expression XPath expression function(){'x'}() crashes with TypeError: this.closureContext.localVars.slice is not a function.

It appears that context.localVars is set to {} when it should be [].

I can't see where this initialization is happening.

History

#1 Updated by Michael Kay 3 months ago

  • Assignee changed from Michael Kay to John Lumley

It appears to be XPathEval line 1051

evalContext.localVars = topContext.paramVars;

where paramVars is a map of parameters rather than an array.

I'm not sure how this is supposed to work - the code needs to map parameter names to slot numbers.

#2 Updated by Michael Kay 3 months ago

Changing two places where paramVars is initialized to set the initial value to [] rather than {} seems to do the trick.

#3 Updated by Debbie Lockett 3 days ago

  • Status changed from New to Resolved
  • Assignee changed from John Lumley to Michael Kay
  • Fix Committed on JS Branch 2.0 added

Marking as resolved: the code patch was committed on the saxon-js-enterprise git repo on 2020-06-25 (under 'Implement more Saxon extension functions and "dot function" syntax;' commit).

Please register to edit this issue

Also available in: Atom PDF Tracking page