Project

Profile

Help

Bug #5662

closed

Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ button

Added by Gerrit Imsieke about 1 month ago. Updated 1 day ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
2022-08-26
Due date:
% Done:

0%

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

Description

If you go to https://gimsieke.github.io/xpathle/#daily_2022-08-26 and push the “use stats” button and then hit Enter or push “Submit“, an error “Uncaught TypeError: this.al is not a function” is thrown. I’ve changed the JS to SaxonJS2.js in order to facilitate debugging.

The same error occurs if you reduce the evaluated XPath expression to //*/namespace-uri(), //*/name(), //*/local-name(), or /descendant-or-self::*[40]/name().

Actions #1

Updated by Gerrit Imsieke about 1 month ago

This bug seems to be caused by this recent commit in XPathle. It occurs with any document, not just with yesterday’s HTML document. I’m investigating.

Actions #2

Updated by Gerrit Imsieke about 1 month ago

I circumvented it with this commit. The issue seems to arise when the predicate [ancestor-or-self::*] is applied to a non-node, such as a string.

Actions #3

Updated by Martin Honnen about 1 month ago

I tried to isolate the bug but couldn't so far, a simple XPath evaluation like //*/name()[ancestor-or-self::*] gives a clear error like e.g. Context item for ancestor-or-self axis is not a node - supplied:xs:string('html') instead of that crash where the code seems to look for an axis evaluation on a non-node.

Actions #4

Updated by Norm Tovey-Walsh 29 days ago

  • Sprint/Milestone set to SaxonJS 2.5
Actions #5

Updated by Gerrit Imsieke 29 days ago

You should be able to reproduce the bug if you clone https://github.com/gimsieke/xpathle/, check out commit 00f1360b (before my fix), run create-sef.sh (with the Saxon EE jar location adjusted) and serve the directory from a Web server.

Actions #6

Updated by Norm Tovey-Walsh 1 day ago

  • Status changed from New to AwaitingInfo

Curiously, this bug doesn't occur if you compile with the XX compiler...

Actions #7

Updated by Norm Tovey-Walsh 1 day ago

  • Status changed from AwaitingInfo to Resolved
  • Applies to JS Branch Trunk added
  • Fix Committed on JS Branch 2, Trunk added

It turned out to be a very simple error in the construction of the diagnostic data for the error message. The code was trying to find the axis name by calling this.axisName(operand) which failed because (a) this was the Window object and (b) the only axisName method resolves to a simple lookup anyway. So I replaced it with Expr.axisNames()[operand] and it works.

I decided that it wasn't practical to try to whittle the complex XPathle stylesheet down to a simple test case, so there are no new tests for this fix :-( I did explicitly test the fix on both the saxonjs2 and main branches.

Gerrit, near as I can tell, you still need to put in a xsl:try or something. The stylesheet fails because you're attempting to do an axis operation when the context item is a string. But it doesn't crash the SaxonJS runtime anymore.

Please register to edit this issue

Also available in: Atom PDF Tracking page