]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/bookmarkcache.jsm
Import 1.0 supporting Firefox up to 14.*
[dactyl.git] / common / modules / bookmarkcache.jsm
index 55328a1fe3aa8dfe4c8db978fd437aac7bfcad08..2647848d2f97209cd9c27bf2c5d8fa255a2883b4 100644 (file)
@@ -42,7 +42,19 @@ update(Bookmark.prototype, {
         if (!this.charset || this.charset === "UTF-8")
             return encodeURIComponent(str);
         let conv = services.CharsetConv(this.charset);
-        return escape(conv.ConvertFromUnicode(str) + conv.Finish());
+        return escape(conv.ConvertFromUnicode(str) + conv.Finish()).replace(/\+/g, encodeURIComponent);
+    },
+
+    get folder() {
+        let res = [];
+        res.toString = function () this.join("/");
+
+        let id = this.id, parent, title;
+        while ((id    = services.bookmarks.getFolderIdForItem(id)) &&
+               (title = services.bookmarks.getItemTitle(id)))
+            res.push(title);
+
+        return res.reverse();
     }
 })
 Bookmark.prototype.members.uri = Bookmark.prototype.members.url;
@@ -94,8 +106,8 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
         let uri = newURI(node.uri);
         let keyword = services.bookmarks.getKeywordForBookmark(node.itemId);
 
-        let tags = tags in node ? (node.tags ? node.tags.split(/, /g) : [])
-                                : services.tagging.getTagsForURI(uri, {}) || [];
+        let tags = "tags" in node ? (node.tags ? node.tags.split(/, /g) : [])
+                                  : services.tagging.getTagsForURI(uri, {}) || [];
 
         let post = BookmarkCache.getAnnotation(node.itemId, this.POST);
         let charset = BookmarkCache.getAnnotation(node.itemId, this.CHARSET);
@@ -172,7 +184,11 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
         let query = services.history.getNewQuery();
         let options = services.history.getNewQueryOptions();
         options.queryType = options.QUERY_TYPE_BOOKMARKS;
-        options.excludeItemIfParentHasAnnotation = "livemark/feedURI";
+        try {
+            // https://bugzil.la/702639
+            options.excludeItemIfParentHasAnnotation = "livemark/feedURI";
+        }
+        catch (e) {}
 
         let { root } = services.history.executeQuery(query, options);
         root.containerOpen = true;