aboutsummaryrefslogtreecommitdiff
path: root/src/background/shared/completions/bookmarks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/shared/completions/bookmarks.js')
-rw-r--r--src/background/shared/completions/bookmarks.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/background/shared/completions/bookmarks.js b/src/background/shared/completions/bookmarks.js
new file mode 100644
index 0000000..aedaccf
--- /dev/null
+++ b/src/background/shared/completions/bookmarks.js
@@ -0,0 +1,15 @@
+const getCompletions = (keywords) => {
+ return browser.bookmarks.search({ query: keywords }).then((items) => {
+ return items.filter((item) => {
+ let url = undefined;
+ try {
+ url = new URL(item.url);
+ } catch (e) {
+ return false;
+ }
+ return item.type === 'bookmark' && url.protocol !== 'place:';
+ });
+ });
+};
+
+export { getCompletions };