New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError in decode.min.js #881
Comments
I had a deeper look into the javascript and the minified version is obviously invalid: The corresponding code unminified is: function unpackDictionaryData(dictionary, data0, data1, skipFlip, sizeBits, sizeBitsData) {
var /** @type{!Int8Array} */ dict = toUsAsciiBytes(data0 + data1);
if (dict.length != dictionary.length) {
throw "Corrupted brotli dictionary";
}
var /** @type{number} */ offset = 0;
var /** @type{number} */ n = skipFlip.length;
for (var /** @type{number} */ i = 0; i < n; i += 2) {
var /** @type{number} */ skip = skipFlip.charCodeAt(i) - 36;
var /** @type{number} */ flip = skipFlip.charCodeAt(i + 1) - 36;
offset += skip;
for (var /** @type{number} */ j = 0; j < flip; ++j) {
dict[offset] |= 0x80;
offset++;
}
}
for (var /** @type{number} */ i = 0; i < sizeBitsData.length; ++i) {
sizeBits[i] = sizeBitsData.charCodeAt(i) - 65;
}
dictionary.set(dict);
} There is exactly one call to this method, and it's four lines further down: var /** @type{!Int8Array} */ dictionaryData = new Int8Array(122784);
var /** @type{!Int32Array} */ dictionarySizeBits = new Int32Array(25);
unpackDictionaryData(dictionaryData, "... So it's obvious, that the first arg to the method is of type The attached minified version was generated using the following Dockerfile: FROM node
WORKDIR /src
RUN npm i minify -g
RUN wget https://github.com/google/brotli/raw/master/js/decode.js
RUN minify decode.js > decode.min.js Until the actual build pipeline for these files is fixed, I'd suggest to simply replace the files with the ones attached. BR (Note: a previous version of this comment incorrectly stated that there was unused code in the JS file. I apologise for this mistake. However, the analysis that the minified file is not working still stands) |
It's been months on this topic without any response. I must say I find it bizarre that such a trivially fixable issue isn't even responded to. Clearly other people are affected too. Please just use a non-broken minifier to produce a correct version of your code. Thanks |
Hello. Sorry for the super-long delay. Could you, please, check that decode.min.js works for you now? |
Important: now decode.js / decode.min.js is a module; so the updated usage example looks like this:
|
Hi @eustas, I can confirm that the new version works. Thank you. Best regards |
Hi, I've just downloaded decode.min.js and integrated it into my app according to the these Microsoft docs.
I get a
TypeError: e.Q is not a function
.When pretty-printing the file in dev-tools, the error is in this section of the file:
Is this a problem with the minified JS file or with the code calling it?
The code that interacts with brotli is this:
The text was updated successfully, but these errors were encountered: