diff --git a/src/background/bookmarking/BuiltinBookmarking.js b/src/background/bookmarking/BuiltinBookmarking.js index 0ff990c9..f631415d 100644 --- a/src/background/bookmarking/BuiltinBookmarking.js +++ b/src/background/bookmarking/BuiltinBookmarking.js @@ -81,6 +81,8 @@ class BuiltinBookmarking { if (Utils.bookmarkIsSeparator(bookmarkInfo)) return; if (Utils.bookmarkIsBlankWebPage(bookmarkInfo)) return; if (Utils.bookmarkIsRegularFolder(bookmarkInfo)) return; + const bookmarkIsCurrentPage = await Utils.bookmarkIsCurrentPage(bookmarkInfo); + if (!bookmarkIsCurrentPage) return; await this._moveBookmarkToDefinedLocation(bookmarkInfo); } } diff --git a/src/background/utils/Utils.js b/src/background/utils/Utils.js index 50b6d3da..9c8fc02d 100644 --- a/src/background/utils/Utils.js +++ b/src/background/utils/Utils.js @@ -149,6 +149,16 @@ class Utils { return isRegularFolder; } + // Indicate if a bookmark object is for the current page + static async bookmarkIsCurrentPage(bookmarkInfo) { + let isCurrentPage = false; + if (Utils.bookmarkIsWebPage(bookmarkInfo)) { + const newlyActiveTab = await Utils.getActiveTab(); + isCurrentPage = bookmarkInfo.url === newlyActiveTab.url; + } + return isCurrentPage; + } + // Indicate if the provided bookmarks are all in the specified folder static allBookmarksAreInFolder(folderId, bookmarks) { let result = true;