From 1d733acea25603f166b5c206a3680fd7fbab3efd Mon Sep 17 00:00:00 2001 From: Pawel Andruszkiewicz Date: Tue, 1 Sep 2015 12:16:39 +0200 Subject: [PATCH] [Filesystem] Fixed readBytes(). Error detected while working with XWALK-737. [Verification] TCT pass rate did not change. Change-Id: Icd0235faf42666cecb747558de7bc2d0334de189 Signed-off-by: Pawel Andruszkiewicz --- src/filesystem/js/file_stream.js | 7 ++----- src/utils/utils_api.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/filesystem/js/file_stream.js b/src/filesystem/js/file_stream.js index 289ede66..b0e8953b 100755 --- a/src/filesystem/js/file_stream.js +++ b/src/filesystem/js/file_stream.js @@ -159,13 +159,10 @@ FileStream.prototype.readBytes = function() { if (native_.isFailure(result.reply)) { throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Could not read'); } - var bytes = []; - for (var i = 0; i < result.output.length; ++i) { - bytes.push(result.output.charCodeAt(i)); - } + this.position = this.position + result.reply.data_size; - return bytes; + return result.output; }; FileStream.prototype.readBase64 = function() { diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 445adedd..dcee69ca 100755 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -1051,7 +1051,7 @@ NativeManager.prototype.callSyncData = function(cmd, args, type, chunk) { }); var response = this.extension.sendSyncData(request, chunk); response.reply = JSON.parse(response.reply); - response.output = this.extension.receiveChunkData(response.chunk_id, "string"); + response.output = this.extension.receiveChunkData(response.chunk_id, type); return response; }; -- 2.34.1