Project

Profile

Help

Bug #4611

closed

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

Added by Michael Kay over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2020-06-25
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

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.


Related issues

Has duplicate SaxonJS - Bug #4653: fn:fold-left with inline function in SaxonJS.XPath.evaluateDuplicateDebbie Lockett2020-07-24

Actions
Actions #1

Updated by Michael Kay over 4 years 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.

Actions #2

Updated by Michael Kay over 4 years ago

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

Actions #3

Updated by Debbie Lockett about 4 years 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).

Actions #4

Updated by Debbie Lockett about 4 years ago

  • Related to Bug #4653: fn:fold-left with inline function in SaxonJS.XPath.evaluate added
Actions #5

Updated by Debbie Lockett about 4 years ago

  • Related to deleted (Bug #4653: fn:fold-left with inline function in SaxonJS.XPath.evaluate)
Actions #6

Updated by Debbie Lockett about 4 years ago

  • Has duplicate Bug #4653: fn:fold-left with inline function in SaxonJS.XPath.evaluate added
Actions #7

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #8

Updated by Community Admin almost 4 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (2.0)
Actions #9

Updated by Debbie Lockett over 3 years ago

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

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

Please register to edit this issue

Also available in: Atom PDF Tracking page