readium/readium-js

Runtime exception with the zip-js dependency

jccr opened this issue · 7 comments

jccr commented

This issue is a Bug

Expected Behaviour

  • Not to halt JS execution with an exception when parsing/loading the minified code artifacts of this project

Observed Behaviour

  • Execution halts with an error: SyntaxError: Functions cannot be declared in a nested block in strict mode

Steps to reproduce

  1. Run npm run prepare
  2. Run npm run build
  3. Find that the built artifacts include code references to this section of the code in zip-js:
    https://github.com/gildas-lormeau/zip.js/blob/master/WebContent/zip-fs.js#L163
  4. Try to run a web app built using those artifacts

Product

  • Readium cloud reader app
    • latest development build
    • PhantomJS 2.1
    • macOS Sierra

Additional information

This appears to only be an issue on PhantomJS 2.x possibly Safari 8 as well.

jccr commented

Filed an issue with the upstream zip-js repo:
gildas-lormeau/zip.js#168

@jccr I don't think Readium pulls in that zip js repo directly. I believe it pulls in this fork: https://github.com/danielweck/zip.js, so shouldn't the issue you created be on that fork instead of the original repo?

Actually, it is correct to expect Juan's reported "bug" (which only seems to occur in old webkit builds like PhantomJS and Safari 8 (?)) to be caused by code in the upstream / original project repository.

In ReadiumJS, this external library is forked in order to add the following code modifications:
gildas-lormeau/zip.js@master...danielweck:master

In fact, note that this is a fork of another fork :)
gildas-lormeau/zip.js@master...ryanackley:master

Yeah, I understand the bug originated in the original repo, I'm just saying that if it's been forked that it may be more quickly resolved within the fork instead of the original - in looking at the original, there's less and less activity when looking at commits from 2015 to current.

This is also affecting Safari 9.

Oh, that makes sense! Thanks :)