[Exif] Fix exception throwing constructor 78/168978/2
authorPawel Kaczmarczyk <p.kaczmarczy@samsung.com>
Thu, 1 Feb 2018 12:43:25 +0000 (13:43 +0100)
committerPawel Kaczmarczyk <p.kaczmarczy@samsung.com>
Mon, 5 Feb 2018 08:12:00 +0000 (09:12 +0100)
Invalid values error could be thrown by ExifInformation constructor.

[Verification] tct-exif-tizen-tests passrate: 100%

Change-Id: Icee96c47faa4c8327b8dec9c9509bd9a53720e15
Signed-off-by: Pawel Kaczmarczyk <p.kaczmarczy@samsung.com>
src/exif/exif_api.js

index 3040336..3d2cd51 100644 (file)
@@ -243,7 +243,7 @@ ExifManager.prototype.saveExifInfo = function() {
     }
   ]);
 
-  if (!_isValidAbsoluteURI(args.exifInfo.uri)) {
+  if (!args.exifInfo.uri || !_isValidAbsoluteURI(args.exifInfo.uri)) {
     setTimeout(function() {
       native_.callIfPossible(args.errorCallback, new WebAPIException(
           WebAPIException.INVALID_VALUES_ERR,
@@ -310,19 +310,10 @@ ExifManager.prototype.getThumbnail = function() {
   native_.call('ExifManager_getThumbnail', {'uri': args.uri}, _callback);
 };
 
-tizen.ExifInformation = function() {
+tizen.ExifInformation = function(exifInitDict) {
   validator_.isConstructorCall(this, tizen.ExifInformation);
 
-  var args = validator_.validateArgs(arguments, [
-    {
-      name: 'ExifInitDict',
-      type: validator_.Types.DICTIONARY,
-      optional: true,
-      nullable: false
-    }
-  ]);
-
-  var uri_ = null,
+  var uri_ = '',
       width_ = null,
       height_ = null,
       deviceMaker_ = null,
@@ -342,14 +333,6 @@ tizen.ExifInformation = function() {
       gpsTime_ = null,
       userComment_ = null;
 
-  var exifInitDict = args.ExifInitDict;
-  if (exifInitDict) {
-    if (exifInitDict.uri === null) {
-      throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
-          'Parameter "uri" is required.');
-    }
-  }
-
   Object.defineProperties(this, {
     uri: {
       get: function() {