X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fmodules%2Fbookmarkcache.jsm;h=be55f9816cbc28955f3c802e8a2ae9146c6f0943;hb=3d837eb266a3a01d424192aa4ec1a167366178c5;hp=55328a1fe3aa8dfe4c8db978fd437aac7bfcad08;hpb=9044153cb63835e39b9de8ec4ade237c03e3888a;p=dactyl.git diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index 55328a1..be55f98 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -2,13 +2,12 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; -Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("bookmarkcache", { exports: ["Bookmark", "BookmarkCache", "Keyword", "bookmarkcache"], require: ["services", "util"] -}, this); +}); this.lazyRequire("storage", ["storage"]); @@ -42,7 +41,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 +105,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 +183,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; @@ -247,4 +262,4 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), { endModule(); -// vim: set fdm=marker sw=4 sts=4 et ft=javascript: +// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: