From: Arkadiusz Pietraszek Date: Mon, 8 Jan 2018 15:23:33 +0000 (+0100) Subject: [Filesystem] Fix to commit ce958812096 to read 64 Kb and greater files X-Git-Tag: submit/tizen_3.0/20180116.110805~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F88%2F166188%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Filesystem] Fix to commit ce958812096 to read 64 Kb and greater files Commit ce958812096 has introduced error in which only first 64 Kb of text file was read. [Verification] TCT pass rate is 100% Automated tests has been run: tct-archive-tizen-tests tct-systeminfo-tizen-tests tct-content-tizen-tests tct-filesystem-tizen-tests Change-Id: I266c839e78af9420bdad328e8fa4332bdc16b8a4 --- diff --git a/src/filesystem/js/file.js b/src/filesystem/js/file.js index 84248264..a55531d5 100644 --- a/src/filesystem/js/file.js +++ b/src/filesystem/js/file.js @@ -324,20 +324,24 @@ function readAsText() { function readFile() { var result, encoded, buffers = []; - result = native_.callSync('File_readSync', data); - if (native_.isFailure(result)) { - setTimeout(function() { - native_.callIfPossible(args.onerror, native_.getErrorObject(result)); - }, 0); - return; - } - result = native_.getResultObject(result); - if (result.length) { - data.offset += data.length; - } + var output = ""; + do { + result = native_.callSync('File_readSync', data); + if (native_.isFailure(result)) { + setTimeout(function() { + native_.callIfPossible(args.onerror, native_.getErrorObject(result)); + }, 0); + return; + } + result = native_.getResultObject(result); + if (result.length) { + data.offset += data.length; + } + output = output + result; + } while (result.length); setTimeout(function() { - native_.callIfPossible(args.onsuccess, result); + native_.callIfPossible(args.onsuccess, output); }, 0); }