Fix RangeError: Maximum call stack size exceeded

This commit is contained in:
liasica 2022-06-05 00:41:27 +08:00
parent ee1b0d7ff7
commit 4fa28b0798
2 changed files with 6 additions and 2 deletions

View File

@ -147,7 +147,9 @@ public class JavaScriptBridgeJS {
" });" +
" }," +
" arrayBufferToString: function(arrayBuffer) {" +
" return String.fromCharCode.apply(String, arrayBuffer);" +
" const uint8Array = new Uint8Array(arrayBuffer);" +
" const data = uint8Array.reduce((acc, i) => acc += String.fromCharCode.apply(null, [i]), '');" +
" return data;" +
" }," +
" isBodyFormData: function(bodyString) {" +
" return bodyString.indexOf('------WebKitFormBoundary') >= 0;" +

View File

@ -175,7 +175,9 @@ let UTIL_JS_SOURCE = """
});
},
arrayBufferToString: function(arrayBuffer) {
return String.fromCharCode.apply(String, arrayBuffer);
const uint8Array = new Uint8Array(arrayBuffer);
const data = uint8Array.reduce((acc, i) => acc += String.fromCharCode.apply(null, [i]), '');
return data;
},
isBodyFormData: function(bodyString) {
return bodyString.indexOf('------WebKitFormBoundary') >= 0;