[Bookmark] Fix recursion and returned type of url
authorKarol Pawlowski <k.pawlowski@samsung.com>
Thu, 15 Jan 2015 10:33:20 +0000 (11:33 +0100)
committerKarol Pawlowski <k.pawlowski@samsung.com>
Thu, 15 Jan 2015 10:37:53 +0000 (11:37 +0100)
[Verification]
    TCT result: 36/36

Change-Id: If90fee74af77b00291d02a4165716521b25faa27
Signed-off-by: Karol Pawlowski <k.pawlowski@samsung.com>
src/bookmark/bookmark_api.js

index 7947a6206ad8b970119dee58a45ad2e92cac2f56..f797897ad4a612e2c0286570964bf9b4af102921 100644 (file)
@@ -135,13 +135,13 @@ BookmarkProvider.prototype.addToFolder = function() {
       nullable: false}
   ]);
   var ret = native_.callSync('Bookmark_add',
-      {
-        title: args.bookmark.title,
-        url: args.bookmark.url || '/',
-        parentId: args.parentId,
-        type: args.bookmark instanceof tizen.BookmarkFolder ? 1 : 0
-      }
-      );
+    {
+      title: args.bookmark.title,
+      url: args.bookmark.url,
+      parentId: args.parentId,
+      type: args.bookmark instanceof tizen.BookmarkFolder ? 1 : 0
+    }
+  );
   if (native_.isFailure(ret)) {
     return false;
   }
@@ -234,9 +234,10 @@ BookmarkProvider.prototype.getFolderItems = function() {
       obj.parent = this.getFolder(item.parentId);
       _edit.disallow();
       result.push(obj);
-      if (args.recursive) {
-        result = result.concat(this.getFolderItems(item.id, true));
-      }
+    }
+
+    if (args.recursive) {
+      result = result.concat(this.getFolderItems(item.id, true));
     }
   }
   return result;
@@ -291,6 +292,8 @@ tizen.BookmarkItem = function() {
     },
     url: {
       get: function() {
+        if (args.url === "undefined")
+          args.url = undefined;
         return args.url;
       },
       enumerable: true,