You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by kn...@apache.org on 2019/03/12 06:23:14 UTC
[cordova-plugin-file] branch travis_tests updated: more logs for
safari
This is an automated email from the ASF dual-hosted git repository.
knaito pushed a commit to branch travis_tests
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-file.git
The following commit(s) were added to refs/heads/travis_tests by this push:
new 3b951ca more logs for safari
3b951ca is described below
commit 3b951ca1632b92ebacd42f04e30ec8946ef686e1
Author: knaito <kn...@asial.co.jp>
AuthorDate: Tue Mar 12 15:22:53 2019 +0900
more logs for safari
---
src/browser/FileProxy.js | 6 +++++
tests/tests.js | 64 ++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/src/browser/FileProxy.js b/src/browser/FileProxy.js
index 332536b..c0e92b8 100644
--- a/src/browser/FileProxy.js
+++ b/src/browser/FileProxy.js
@@ -101,6 +101,8 @@
var root = new DirectoryEntry('', DIR_SEPARATOR);
fs_ = new FileSystem(name, root);
+ window.customLog('log', 'FileSystem = ' + name);
+ window.customLog('log', 'storageName = ' + storageName);
idb_.open(storageName, function () {
// window.customLog('log', '***** ' + successCallback.toString());
successCallback(fs_);
@@ -144,6 +146,10 @@
path = resolveToFullPath_(fullPath, path);
window.customLog('log', 'idb_.get: path:' + path.storagePath);
+ window.customLog('log', '=> fileName:' + path.fileName);
+ window.customLog('log', '=> fullPath:' + path.fullPath);
+ window.customLog('log', '=> fsName:' + path.fsName);
+ window.customLog('log', '=> fs_.root:' + fs_.root);
idb_.get(path.storagePath, function (fileEntry) {
if (options.create === true && options.exclusive === true && fileEntry) {
window.customLog('log', 'getFile is called 1');
diff --git a/tests/tests.js b/tests/tests.js
index 723f063..22733ab 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -208,6 +208,34 @@ exports.defineAutoTests = function () {
return (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1 && ua.indexOf('edge') === -1);
};
+ function MyFile (opts) {
+ var blob_ = new Blob(); // eslint-disable-line no-undef
+
+ this.size = opts.size || 0;
+ this.name = opts.name || '';
+ this.type = opts.type || '';
+ this.lastModifiedDate = opts.lastModifiedDate || null;
+ this.storagePath = opts.storagePath || '';
+
+ // Need some black magic to correct the object's size/name/type based on the
+ // blob that is saved.
+ Object.defineProperty(this, 'blob_', {
+ enumerable: true,
+ get: function () {
+ return blob_;
+ },
+ set: function (val) {
+ blob_ = val;
+ this.size = blob_.size;
+ this.name = blob_.name;
+ this.type = blob_.type;
+ this.lastModifiedDate = blob_.lastModifiedDate;
+ }.bind(this)
+ });
+ }
+
+ MyFile.prototype.constructor = MyFile;
+
var openDb = function (nextTask, errorTask) {
var FILE_STORE_ = 'testentries';
var dbName = 'hogehoge';
@@ -237,7 +265,7 @@ exports.defineAutoTests = function () {
request.onsuccess = function (e) {
mydb = e.target.result;
mydb.onerror = onError;
- window.customLog('log', 'step 1');
+ window.customLog('log', 'step 1B');
nextTask(mydb, FILE_STORE_);
};
@@ -266,11 +294,33 @@ exports.defineAutoTests = function () {
function (mydb, storeName) {
window.customLog('log', 'step 1');
- var myentry = {
- 'myname': 'hogehoge',
- 'mytime': new Date()
- };
- var mypath = '/aaa/bbb';
+ // var myentry = {
+ // 'myname': 'hogehoge',
+ // 'mytime': new Date()
+ // };
+ var mypath = 'file:///persistent/file.spec.9';
+ var myname = 'hogehogehoge';
+ // var myentry = new MyFile({
+ // size: 0,
+ // name: myname,
+ // lastModifiedDate: new Date(),
+ // storagePath: mypath
+ // });
+ var DIR_SEPARATOR = '/';
+
+ var root = new DirectoryEntry('', DIR_SEPARATOR);
+ var fs_ = new FileSystem('persistent', root);
+ var myentry = new FileEntry('file.spec.0', // fileName
+ '/file.spec.0', // fullPath
+ new FileSystem('persistent', fs_.root));
+
+ myentry.file_ = new MyFile({
+ size: 0,
+ name: myname,
+ lastModifiedDate: new Date(),
+ storagePath: mypath
+ });
+
var tx = mydb.transaction([storeName], 'readwrite');
tx.objectStore(storeName).put(myentry, mypath);
@@ -293,7 +343,7 @@ exports.defineAutoTests = function () {
tx2.oncomplete = function () {
window.customLog('log', 'ALL OK');
window.customLog('log', !!request2.result);
- window.customLog('log', JSON.stringify(request2.result));
+ window.customLog('log', request2.result);
done();
};
var request2 = tx2.objectStore(storeName2).get(mypath);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org