LZMA-JS / LZMA-JS

A JavaScript implementation of the Lempel-Ziv-Markov (LZMA) chain compression algorithm
http://nmrugg.github.io/LZMA-JS/
MIT License
669 stars 127 forks source link

Minifyed version of lzma_worker don't work #45

Open xspager opened 8 years ago

xspager commented 8 years ago

Banged my head against the wall until I tried to use other compressor and it solved my problem of my callbacks never being called.

addaleax commented 8 years ago

@xspager Can you maybe post a code excerpt showing how you used this library? The minified versions are run during testing, too, so it’s weird when they show different behaviour.

xspager commented 8 years ago

Try this silly link http://lzma.danielocl.com.br/?encoded=XQAAgABfGAAAAAAAAAAeCEUG0O+oKBdZ2ZnigHuyv5PyVJT3ghQBA6vXJICCR8hGR7AOhDQ5m+JcZGRr8Gs8CImWcLE/bUzf63NBedNfce1/suatf61JhZVCQlUVxy1tQBlqfFt1adlhK+EfjazTcFOXglnnbObL/iOoS6JpCT0eIDx+rZCsQIt4H9+QprLlcgYZOKDkCo2K3aFQZilhtpHhC5JmcXv/FyvLcmvXAkNkK9qJK6ameheNOsbQ6yDy2XTDxysP4QMJ71qzDHJzvF2iWa/e9a3cqGAa4VSa0xii6dRNM3oAMloxJvfazAUMJy1evTJJsoTlKlJr4UZlteTi+ZLVTf83IHxHmiyzCAll0GSs3wa9g/lfaXzkEVEWoXz1eWJZ5ZNZ7uoSZsbseV7NM/WSCHZcactzWdxxsR0D76wGt6ofNUuR2Y+DNfHWclyToFa40WoAMDPWq3z/JnSLlxmb+dJ1MTOt+zsLpfOBsu1ZnIPxfMYemOs+bioPsPBHO0VaxaueKbrPmnwvmHVx8fMgWWo37iEQUqKlayrV8wkBNTFnzo5FaA9tkHbM6ePIv23qTUnZRRR27LwvtpbUm/P2EDBLBPO4+72tdNJFUMFAyrUzuRSTD2HQQrevqI87GxCDzS9rKUKdYSFUpaIGHS4ineHmdKqNzmhCfAqWZ8LowXuow3NtA/fBxy35b4G6XA10UQ5+xOgB6Zi7rEToAwFmYEji+paAjMTU6s/gFD5PQJltki8NHA6l/I/0WH5nAndBypNQ8uF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DYUt+0mpL00WeqKStWZpGn3kdazinq3EhRk/eRBSHguTkEUw+3OnvMXzfH2I1sI8EPq5VqN7jYT9B858myKodrc3FdhHUUCIHDttpPPLBOqz5zAeJwCDivAEiIhOQFxpO3HG6Q8Fd6bimfaqJaoEPBllCP9iXnt02x2TQI+8GC+CK+TqjD746Xfy1HUO2qtQhtptNiEpQcjxnalVKaedkDiV7hbZCJF/OmVnYEhLJYK2HvZ6bQnS24y2DD3MH92xdDt9BN2t+hl9b2/8zHa5a5+bMSamAPXytDa5EMxuJlKSQjJTxW+3YjcZs5pcOTtqkU+2S7LjO7ZSmGy3zZNaGPtjg0PwzgvA6SdLOiTTTSR++TXwziH59BUP1lmBd246o9mLdbh07GwhabbNVI4GtBHMxROkewiq1LYxL7a7xxifftVeikUjX9FCoG2ug5SBuPur2cOG7Ks9TQk0/7iRYm48/jQZXgOhaD8knFKdh+sVNuDT1wNmIbK+NM5lbNjN8EyBZbTN9SIjmhUvmPv0feremFrmRDF4U4AbxR4U7NkjO6WOM4WIFKL5568dB970Jd0ze0+0wrFjh+zxR5IvJW74qdz9hKnIYfFTkdGmV48U46QRJ9yiWctE0kBhb4BIHOYkcH3hof56ASbhuwg3NuImNDnr814aHm8CcVyw4A1rzwCRXhKbAr70ngypuk3ld/ZlRDcJt0tmqImiNIREfpwOEPqCFld2UKiEXDdS9fUJr3EwMo+g/NERSXUfWOWaqR3Xk8O+lKQHIFbXCllv/ynZHe 😄 or look at https://github.com/xspager/lzma_url/blob/master/index.html#L11

xspager commented 8 years ago

oh, btw, if ether use the non minifyed or my minifyed version it does work.

addaleax commented 8 years ago

You mean the version before xspager/lzma_url@b18cb817668c did not work? I can’t really reproduce that locally… what kind of browser were you using? I assume your minified version is made from the same base lzma_worker.js?

xspager commented 8 years ago

Firefox. Yes, earlier I was using the non minifyed version. Yes, the same.

addaleax commented 8 years ago

… The lzma_worker.js in the current HEAD of your repo is from 7c6bf75cbb42b2e48b67e7891a9ee755079b3b0e here, the lzma_worker-min.js from the previous commit in your repo is from 28aaa8e66b2c093b9f24327407853e9db14e0414 here. So no, the minified version you got is not from the same lzma_worker.js… can you try again with the current versions?

xspager commented 8 years ago

Got "DataCloneError: The object could not be cloned." on the browser error console

addaleax commented 8 years ago

@xspager Is that from bower or from the repo here/npm/…? That error came up as part of a known issue that has been fixed in d7ad0f85528, but I think @nmrugg forgot to push tags for 2.3.1 and 2.3.2 to this repository…

xspager commented 8 years ago

Sorry, i got distracted. I try using another minifier and https://www.npmjs.com/package/minifier generate a bigger file but it runs fine on firefox

ColaColin commented 8 years ago

Also had this issue, this version does not work, calling compress just results in nothing, no callbacks, no errors, just nothing. Happend on chrome and firefox to me. https://github.com/nmrugg/LZMA-JS/blob/master/src/lzma_worker-min.js

I've minified my own version using googles closure compiler, it appears to work. It shows this warning during compile: JSC_USELESS_CODE: Suspicious code. This code lacks side-effects. Is there a bug? at line 285 character 567 ...its) , encoder.nowPos64 = P0_longLit , undefined) , $Chunker_0({}, encoder)); ^

Maybe those somehow are related.

greggman commented 5 years ago

Same issue. Just cloned to repo. .min versons never return on compress. non min versions do. In Chrome v75 if that matters.

Also compress returns a native array (was assumng it would return an typed array) of compressed data