Updates from Kiwix JS

Former-commit-id: c782a998f6cb60785b590d5b65ac77d22b03a126 [formerly 2b27b93e05fe72760e97eae83808c8517de1cd13 [formerly b081098996accb5e5d076d1cc4193142b06830e9]]
Former-commit-id: a7e376811f1a71e85a64b746c2a58d608bec988b
Former-commit-id: 1b62e0abf09d742a88311aeea1545c0b53c2adea
This commit is contained in:
Jaifroid 2021-08-27 14:44:59 +01:00
parent ffd6317b38
commit 9534cbfcd1
5 changed files with 7 additions and 12 deletions

View File

@ -183,4 +183,4 @@ define([], function() {
return { return {
read: read read: read
}; };
}); });

View File

@ -54,8 +54,6 @@ define(rqDefXZ, function(uiUtil) {
var xzdec; var xzdec;
XZ().then(function (instance) { XZ().then(function (instance) {
// TEST ERROR CODE: UNCOMMENT TO TEST AND REMOVE BEFORE MERGE
// throw params.decompressorAPI.assemblerMachineType + ' broken!';
xzdec = instance; xzdec = instance;
}).catch(function (err) { }).catch(function (err) {
if (params.decompressorAPI.assemblerMachineType === 'ASM') { if (params.decompressorAPI.assemblerMachineType === 'ASM') {
@ -67,8 +65,6 @@ define(rqDefXZ, function(uiUtil) {
XZ = null; XZ = null;
require(['xzdec-asm'], function () { require(['xzdec-asm'], function () {
XZ().then(function (instance) { XZ().then(function (instance) {
// TEST ERROR CODE: UNCOMMENT TO TEST AND REMOVE BEFORE MERGE
// throw params.decompressorAPI.assemblerMachineType + ' broken!';
xzdec = instance; xzdec = instance;
}).catch(function (err) { }).catch(function (err) {
uiUtil.reportAssemblerErrorToAPIStatusPanel('XZ', err); uiUtil.reportAssemblerErrorToAPIStatusPanel('XZ', err);

View File

@ -211,8 +211,8 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
})); }));
// Get the full array of combinations to check number of combinations // Get the full array of combinations to check number of combinations
var fullCombos = util.removeDuplicateStringsInSmallArray(util.allCaseFirstLetters(prefix, 'full')); var fullCombos = util.removeDuplicateStringsInSmallArray(util.allCaseFirstLetters(prefix, 'full'));
// Put cap on exponential number of combinations (five words = 3^6 = 243 combinations) // Put cap on exponential number of combinations (five words = 3^5 = 243 combinations)
search.type = fullCombos.length < 250 ? 'full' : 'basic'; search.type = fullCombos.length < 300 ? 'full' : 'basic';
// We have to remove duplicate string combinations because util.allCaseFirstLetters() can return some combinations // We have to remove duplicate string combinations because util.allCaseFirstLetters() can return some combinations
// where uppercase and lowercase combinations are exactly the same, e.g. where prefix begins with punctuation // where uppercase and lowercase combinations are exactly the same, e.g. where prefix begins with punctuation
// or currency signs, for languages without case, or where user-entered case duplicates calculated case // or currency signs, for languages without case, or where user-entered case duplicates calculated case
@ -288,7 +288,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
* *
* @param {String} prefix The case-sensitive value against which dirEntry titles (or url) will be compared * @param {String} prefix The case-sensitive value against which dirEntry titles (or url) will be compared
* @param {Object} search The appstate.search object (for comparison, so that we can cancel long binary searches) * @param {Object} search The appstate.search object (for comparison, so that we can cancel long binary searches)
* @param {Function} callback The function to call with the array of dirEntries with titles that begin with prefix * @param {callbackDirEntryList} callback The function to call with the array of dirEntries with titles that begin with prefix
* @param {Integer} startIndex The index number with which to commence the search, or null * @param {Integer} startIndex The index number with which to commence the search, or null
*/ */
ZIMArchive.prototype.findDirEntriesWithPrefixCaseSensitive = function(prefix, search, callback, startIndex) { ZIMArchive.prototype.findDirEntriesWithPrefixCaseSensitive = function(prefix, search, callback, startIndex) {

View File

@ -40,6 +40,9 @@
* A global variable to track the assembler machine type and the last used decompressor (for reporting to the API panel) * A global variable to track the assembler machine type and the last used decompressor (for reporting to the API panel)
* This is populated in the Emscripten wrappers * This is populated in the Emscripten wrappers
* @type {Object} * @type {Object}
* @property {String} assemblerMachineType The assembler machine type supported and/or loaded by this app: 'ASM' or 'WASM'
* @property {String} decompressorLastUsed The decompressor that was last used to decode a compressed cluster (currently 'XZ' or 'ZSTD')
* @property {String} errorStatus A description of any detected error in loading a decompressor
*/ */
params.decompressorAPI = { params.decompressorAPI = {
assemblerMachineType: null, assemblerMachineType: null,

View File

@ -102,8 +102,6 @@ define(rqDefZD, function(uiUtil) {
}; };
ZD().then(function (inst) { ZD().then(function (inst) {
// TEST ERROR CODE: UNCOMMENT TO TEST AND REMOVE BEFORE MERGE
// throw params.decompressorAPI.assemblerMachineType + ' broken!';
instantiateDecoder(inst); instantiateDecoder(inst);
}).catch(function (err) { }).catch(function (err) {
if (params.decompressorAPI.assemblerMachineType === 'ASM') { if (params.decompressorAPI.assemblerMachineType === 'ASM') {
@ -115,8 +113,6 @@ define(rqDefZD, function(uiUtil) {
ZD = null; ZD = null;
require(['zstddec-asm'], function () { require(['zstddec-asm'], function () {
ZD().then(function (inst) { ZD().then(function (inst) {
// TEST ERROR CODE: UNCOMMENT TO TEST AND REMOVE BEFORE MERGE
// throw params.decompressorAPI.assemblerMachineType + ' broken!';
instantiateDecoder(inst); instantiateDecoder(inst);
}).catch(function (err) { }).catch(function (err) {
uiUtil.reportAssemblerErrorToAPIStatusPanel('ZSTD', err); uiUtil.reportAssemblerErrorToAPIStatusPanel('ZSTD', err);