From: Piotr Kosko/Native/Web API (SWP) /SRPOL/Professional/삼성전자
Date: Mon, 26 Nov 2018 08:08:12 +0000 (+0100)
Subject: [Filesystem] Fixing return behaviour for FileHandle object
X-Git-Tag: submit/tizen_5.0/20181126.103411~2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57ff96f0a478566206be365a75a08c2c23c75359;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Filesystem] Fixing return behaviour for FileHandle object
[Bug] When returning the asynchronous error while doing an operation on
FileHandle, the processing was not interrupted. Missing return statement
in those cases was added.
[Verification] Code compiles without errors.
TCT passrate for Filesystem - 100%
Change-Id: Ie8ba77922fa74c0263c40e55a157c2979b893cff
Signed-off-by: Piotr Kosko/Native/Web API (SWP) /SRPOL/Professional/삼성전자
---
diff --git a/src/filesystem/js/file.js b/src/filesystem/js/file.js
index 990e4281..0885dead 100644
--- a/src/filesystem/js/file.js
+++ b/src/filesystem/js/file.js
@@ -74,7 +74,7 @@ File.prototype.toURI = function() {
function stringToRegex(str) {
var _regString = '^';
if (str === '') {
- return new RegExp(_regString, 'i');
+ return new RegExp(_regString + "$", 'i');
}
// single '\' sign is not visible in JS string, escaping % wildcard need to be done by '\\%'
str = str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
diff --git a/src/filesystem/js/file_handle.js b/src/filesystem/js/file_handle.js
index d45a1d17..3d9a2ed9 100644
--- a/src/filesystem/js/file_handle.js
+++ b/src/filesystem/js/file_handle.js
@@ -68,6 +68,7 @@ FileHandle.prototype.seekNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
var data = {id: this.id, offset: args.offset, blocking: false};
if (undefined === args.whence) {
@@ -128,6 +129,7 @@ FileHandle.prototype.readStringNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
if ((this.mode === 'w') || (this.mode === 'a')) {
setTimeout(function() {
@@ -135,6 +137,7 @@ FileHandle.prototype.readStringNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is write-only'));
}, 0);
+ return;
}
var data = {id: this.id, encoding: args.inputEncoding, blocking: false};
if (!type_.isNullOrUndefined(args.count)) {
@@ -196,6 +199,7 @@ FileHandle.prototype.writeStringNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
if ('r' === this.mode) {
setTimeout(function() {
@@ -203,6 +207,7 @@ FileHandle.prototype.writeStringNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is read-only'));
}, 0);
+ return;
}
var data =
{id: this.id, string: args.string, encoding: args.outputEncoding, blocking: false};
@@ -265,6 +270,7 @@ FileHandle.prototype.readBlobNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
var data = {id: this.id, blocking: false};
@@ -339,12 +345,14 @@ FileHandle.prototype.writeBlobNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
} else if (this.mode === 'r') {
setTimeout(function() {
native_.callIfPossible(
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is read-only'));
}, 0);
+ return;
}
var encodedData = ArrayToString(blobToUint8Array(args.blob));
@@ -365,6 +373,7 @@ FileHandle.prototype.writeBlobNonBlocking = function() {
setTimeout(function() {
native_.callIfPossible(args.errorCallback, native_.getErrorObject(result));
}, 0);
+ return;
}
};
@@ -403,6 +412,7 @@ FileHandle.prototype.readDataNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
if ((this.mode === 'w') || (this.mode === 'a')) {
setTimeout(function() {
@@ -410,6 +420,7 @@ FileHandle.prototype.readDataNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is write-only'));
}, 0);
+ return;
}
var data = {id: this.id, blocking: false};
@@ -470,12 +481,14 @@ FileHandle.prototype.writeDataNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
} else if (this.mode === 'r') {
setTimeout(function() {
native_.callIfPossible(
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is read-only'));
}, 0);
+ return;
}
var encodedData = ArrayToString(args.data);
@@ -527,6 +540,7 @@ FileHandle.prototype.flushNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
if (this.mode === 'r') {
setTimeout(function() {
@@ -534,6 +548,7 @@ FileHandle.prototype.flushNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is read-only'));
}, 0);
+ return;
}
var data = {id: this.id, blocking: false};
@@ -583,6 +598,7 @@ FileHandle.prototype.syncNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
if (this.mode === 'r') {
setTimeout(function() {
@@ -590,6 +606,7 @@ FileHandle.prototype.syncNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle state is read-only'));
}, 0);
+ return;
}
var data = {id: this.id, blocking: false};
@@ -635,6 +652,7 @@ FileHandle.prototype.closeNonBlocking = function() {
args.errorCallback,
new WebAPIException(WebAPIException.IO_ERR, 'FileHandle is not opened'));
}, 0);
+ return;
}
var data = {id: this.id, blocking: false};