https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2022-08-27T06:47:20ZSaxonica Developer CommunitySaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=216342022-08-27T06:47:20ZGerrit Imsiekegerrit.imsieke@le-tex.de
<ul></ul><p>This bug seems to be caused by <a href="https://github.com/gimsieke/xpathle/commit/f7ef18d" class="external">this recent commit in XPathle</a>. It occurs with any document, not just with yesterday’s HTML document. I’m investigating.</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=216352022-08-27T06:55:17ZGerrit Imsiekegerrit.imsieke@le-tex.de
<ul></ul><p>I circumvented it with <a href="https://github.com/gimsieke/xpathle/commit/01fdedd" class="external">this commit</a>. The issue seems to arise when the predicate <code>[ancestor-or-self::*]</code> is applied to a non-node, such as a string.</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=216362022-08-27T09:03:42ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>I tried to isolate the bug but couldn't so far, a simple XPath evaluation like <code>//*/name()[ancestor-or-self::*]</code> gives a clear error like e.g. <code>Context item for ancestor-or-self axis is not a node - supplied:xs:string('html')</code> instead of that crash where the code seems to look for an axis evaluation on a non-node.</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=216752022-08-31T15:37:08ZNorm Tovey-Walsh
<ul><li><strong>Sprint/Milestone</strong> set to <i>SaxonJS 2.5</i></li></ul> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=216802022-08-31T16:03:21ZGerrit Imsiekegerrit.imsieke@le-tex.de
<ul></ul><p>You should be able to reproduce the bug if you clone <a href="https://github.com/gimsieke/xpathle/" class="external">https://github.com/gimsieke/xpathle/</a>, 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.</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=218682022-09-28T15:10:13ZNorm Tovey-Walsh
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>AwaitingInfo</i></li></ul><p>Curiously, this bug doesn't occur if you compile with the XX compiler...</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=218692022-09-28T15:49:15ZNorm Tovey-Walsh
<ul><li><strong>Status</strong> changed from <i>AwaitingInfo</i> to <i>Resolved</i></li><li><strong>Applies to JS Branch</strong> <i>Trunk</i> added</li><li><strong>Fix Committed on JS Branch</strong> <i>2, Trunk</i> added</li></ul><p>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 <code>this.axisName(operand)</code> which failed because (a) <code>this</code> was the Window object and (b) the only <code>axisName</code> method resolves to a simple lookup anyway. So I replaced it with <code>Expr.axisNames()[operand]</code> and it works.</p>
<p>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 <code>saxonjs2</code> and <code>main</code> branches.</p>
<p>Gerrit, near as I can tell, you still need to put in a <code>xsl:try</code> 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.</p> SaxonJS - Bug #5662: Uncaught TypeError: this.al is not a function in today’s XPathle when using the “use stats“ buttonhttps://saxonica.plan.io/issues/5662?journal_id=219472022-10-04T09:53:34ZNorm Tovey-Walsh
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in JS Release</strong> set to <i>SaxonJS 2.5</i></li></ul><p>Fixed in SaxonJS 2.5.</p>