Merge pull request #1208 from liasica/master

Fix RangeError: Maximum call stack size exceeded
This commit is contained in:
Lorenzo Pichilli 2022-10-13 15:52:35 +02:00 committed by GitHub
commit cb2f02da04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(function(acc, i) { return 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(function(acc, i) { return acc += String.fromCharCode.apply(null, [i]); }, '');
return data;
},
isBodyFormData: function(bodyString) {
return bodyString.indexOf('------WebKitFormBoundary') >= 0;