From b0f55f9d15182072c2bc91db151e8067f6569cfd Mon Sep 17 00:00:00 2001 From: ljjlee Date: Thu, 3 Apr 2025 12:05:22 +0200 Subject: [PATCH] Disambiguate account/local folders sample bookmarks extension (#1435) * Disambiguate account/local folders in the UI for sample bookmarks extension * Code-review markups * Fix lint issues --- functional-samples/sample.bookmarks/popup.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/functional-samples/sample.bookmarks/popup.js b/functional-samples/sample.bookmarks/popup.js index 446e45b7..cff5f0d3 100644 --- a/functional-samples/sample.bookmarks/popup.js +++ b/functional-samples/sample.bookmarks/popup.js @@ -40,7 +40,19 @@ function dumpNode(bookmarkNode, query) { const anchor = $(''); anchor.attr('href', bookmarkNode.url); - anchor.text(bookmarkNode.title); + + // Chrome may have multiple top-level folder nodes with the same title. To + // disambiguate them, include a suffix depending on the value of the + // syncing property. + // + // folderType is set for top-level folders in the tree, and not for child + // folders. In Chrome versions prior to milestone 134, folderType is never + // set. + let title_text = bookmarkNode.title; + if (bookmarkNode.folderType) { + title_text += bookmarkNode.syncing ? ' (Account)' : ' (Local)'; + } + anchor.text(title_text); /* * When clicking on a bookmark in the extension, a new tab is fired with