myisaak / zbar-wasi

Webassembly (WASI) port of Zbar barcode scanner
https://myisaak.github.io/zbar-wasi
12 stars 4 forks source link

Problem on old versions of chrome #3

Open danielebruni opened 3 years ago

danielebruni commented 3 years ago

Hi Isaak

First of all thank you for the great work.

I'm facing a problem with old versions of chrome and webkit based browsers on android (chrome, edge etc.).

The exception i'm getting is

Uncaught TypeError: wasm function signature contains illegal type
    at /wasm-function[11]:28
    at /wasm-function[63]:34
    at /wasm-function[62]:7
    at scanImage (zbar-wasi.esm.js:5186)
    at renderLoop ((index):25)
    at track ((index):70)
    at HTMLVideoElement.domVideo.addEventListener ((index):62)

I was able to reproduce it by using an old version of chromium for windows 72.0.3579.0, which can be downloaded here:

https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/599392/

I have reasons to believe that this exception is also causing #2 , since in the past I noticed a certain coherence between the behaviours of this version of chrome and iOS Safari.

This is as far as I can reach with my limited knwledge of wasm.

Could you please look into it?

Thank you again

Daniele

myisaak commented 3 years ago

Hi Daniele. Thanks for your issue submission. Perhaps at the end of this week I'll have time to look into it. When I do I'll keep you in touch :)

tomriley commented 3 years ago

I've fixed this issue by incorporating polyfills for the wasi calls involving i64 types: https://github.com/tomriley/zbar-wasi/tree/fix-ios#fixios

Solution comes from here: https://github.com/swiftwasm/swiftwasm-pad/tree/master/Frontend/Sources/i64_polyfill

Also fixes #2

myisaak commented 3 years ago

Thanks @tomriley for providing a solution. Feel free create a pull request :)