Project

Profile

Help

Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.

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 2 years ago. Updated about 2 years ago.

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

100%

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 2 years 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 2 years 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 2 years 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 about 2 years ago

  • Sprint/Milestone set to SaxonJS 2.5
Actions #5

Updated by Gerrit Imsieke about 2 years 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 about 2 years 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 about 2 years 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.

Actions #8

Updated by Norm Tovey-Walsh about 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to SaxonJS 2.5

Fixed in SaxonJS 2.5.

Please register to edit this issue

Also available in: Atom PDF Tracking page