Merge branch 'tizen_4.0' into tizen_5.0 26/247926/2
authorPiotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Wed, 18 Nov 2020 11:21:12 +0000 (12:21 +0100)
committerPiotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Wed, 18 Nov 2020 11:23:46 +0000 (12:23 +0100)
Change-Id: I660b3b2b74fb33acbb89b9d06b7a230abee28315

1  2 
packaging/webapi-plugins.spec
src/filesystem/filesystem_instance.cc
src/filesystem/js/file_stream.js

@@@ -8,7 -8,7 +8,7 @@@
  %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions}
  
  Name:       webapi-plugins
- Version:    2.51
 -Version:    2.45
++Version:    2.52
  Release:    0
  License:    Apache-2.0 and BSD-3-Clause and MIT
  Group:      Development/Libraries
@@@ -748,11 -409,13 +748,13 @@@ void FilesystemInstance::FileWriteStrin
      if (encoding == "iso-8859-1") {
        std::vector<std::uint8_t> data;
        latin1::from_utf8(str, data);
 -      write_file(data.data(), data.size(), location, offset, rewrite);
 +      write_file(data.data(), data.size(), location, offset, mode);
+       ReportSuccess(picojson::value{(double)data.size()}, out);
      } else {  // default: UTF-8
        const std::uint8_t* buf = (const std::uint8_t*)str.c_str();
        std::size_t len = str.length();
 -      write_file(buf, len, location, offset, rewrite);
 +      write_file(buf, len, location, offset, mode);
+       ReportSuccess(picojson::value{(double)str.size()}, out);
      }
    } catch (std::runtime_error& e) {
      LoggerE("Cannot write to file %s, cause: %s", location.c_str(), e.what());
@@@ -265,9 -284,10 +265,10 @@@ function write() 
          throw new WebAPIException(WebAPIException.IO_ERR, 'Could not write');
      }
      can_change_size = true;
-     this.position = this.position + args.stringData.length;
+     var written_bytes = native_.getResultObject(result);
+     this.position = this.position + written_bytes;
      can_change_size = false;
 -    this._rewrite = false;
 +    this._truncate = false;
  }
  
  FileStream.prototype.write = function() {