mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-16 01:43:47 +01:00
fix RangeError on chrome71 (#150)
Fixes the following error: RangeError: Too many arguments in function call (only 65534 allowed) The argument limit seems to have become lower in chrome 72...
This commit is contained in:
parent
0124206d64
commit
0e865a5cea
1 changed files with 4 additions and 2 deletions
|
@ -83,8 +83,10 @@ exports.string2buf = function (str) {
|
||||||
|
|
||||||
// Helper (used in 2 places)
|
// Helper (used in 2 places)
|
||||||
function buf2binstring(buf, len) {
|
function buf2binstring(buf, len) {
|
||||||
// use fallback for big arrays to avoid stack overflow
|
// On Chrome, the arguments in a function call that are allowed is `65534`.
|
||||||
if (len < 65537) {
|
// If the length of the buffer is smaller than that, we can use this optimization,
|
||||||
|
// otherwise we will take a slower path.
|
||||||
|
if (len < 65534) {
|
||||||
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
|
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
|
||||||
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
|
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue