Project

Profile

Help

Bug #3067

closed

SaxonJS.min.js not working

Added by Jan Pour almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2016-12-12
Due date:
% Done:

100%

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

Description

I was trying to run Book List sample application using new distribution (Saxon-JS-beta-0.9.1.zip). But when using SaxonJS.min.js it returned:

{
  "name": "XError",
  "message": "No checksum found in SEF",
  "code": "SXJS0006"
}

When using SaxonJS.js it was running ok.

Actions #1

Updated by Debbie Lockett almost 8 years ago

  • Status changed from New to In Progress

Thanks for reporting the problem. Looks like I may need to regenerate the SEFs for the samples.

Actions #2

Updated by Jan Pour almost 8 years ago

Maybe misunderstanding.. I grabbed application files: books.xml, books.xsl, books.css, books.html from the documentation page and tryied to run it on my environment.

So I compiled books.xsl to SEF file using SaxonEE9-7-0-14J. My SEF file ends with processing instruction: - it is not missing.

I don't understand the difference between SaxonJS.js and SaxonJS.min.js other than size - they should work same, no? So why SaxonJS.min.js shows that error? Thanks

Actions #3

Updated by Debbie Lockett almost 8 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100
  • Found in version set to 0.9.1
  • Fixed in version set to 0.9.1.1

Sorry, you are right - the problem was indeed a difference in the behaviour of the minified version, which absolutely should not be the case.

The problem was to do with looking for a Sigma symbol in the checksum processing instruction. In the minified version of Saxon-JS 0.9.1 this had been converted to a literal symbol, rather than "\u03A3" in the non-minified version.

Fixed by replacing with String.fromCharCode(931).

We have done a quick re-build to fix this bug. Please find the new Saxon-JS 0.9.1.1 download on the website http://saxonica.com/saxon-js/index.xml

Actions #4

Updated by Michael Kay almost 8 years ago

To add to Debbie's response:

The JS code is looking for a processing instruction whose name is the single character "Greek capital letter Sigma". The comparison was written (in effect)

if (name == "\u03A3")

In the minified code this had been converted to

if (name == "Σ")

The minified code is thus vulnerable to encoding problems in a way that the original code is not. If the encoding is mis-recognized, the name of the checksum processing instruction will not match this "if" condition, hence the error message that the checksum was not found.

It's not possible for a JS file to identify its own encoding/charset; it relies on the HTML page to do this, and because we can't trust the HTML page to do this correctly, we should avoid having non-ASCII characters in the JS. The patch achieves this by rewriting this code as (effectively)

if (name == String.fromCharCode(931))
Actions #5

Updated by Debbie Lockett over 7 years ago

  • Fixed in JS Release set to Saxon-JS 0.9.1.1
  • Applies to JS Branch 0.9 added
  • Fix Committed on JS Branch 0.9 added

Please register to edit this issue

Also available in: Atom PDF Tracking page