Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix javascript bookmarks #1732

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/adapters/NextcloudBookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes
}
}

await this.checkFeatureJavascriptLinks()

this.abortController = new AbortController()
this.abortSignal = this.abortController.signal

Expand Down Expand Up @@ -234,8 +236,6 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes
async getBookmarksTree(loadAll = false):Promise<Folder<typeof ItemLocation.SERVER>> {
this.list = null // clear cache before starting a new sync

await this.checkFeatureJavascriptLinks()

if (!loadAll) {
return this.getSparseBookmarksTree()
} else {
Expand Down
121 changes: 0 additions & 121 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ describe('Floccus', function() {
await account.delete()
})
it('should create local bookmarks on the server', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -328,10 +324,6 @@ describe('Floccus', function() {
)
})
it('should create empty local folders on the server', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -366,10 +358,6 @@ describe('Floccus', function() {
)
})
it('should create local javascript bookmarks on the server', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -446,9 +434,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -501,9 +486,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -565,9 +547,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -611,10 +590,6 @@ describe('Floccus', function() {
)
})
it('should update the server on local folder moves', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -856,10 +831,6 @@ describe('Floccus', function() {
)
})
it('should not delete additions while sync is running', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -915,10 +886,6 @@ describe('Floccus', function() {
)
})
it('should be able to handle duplicates', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const bookmarkData = {
title: 'url',
Expand Down Expand Up @@ -969,9 +936,6 @@ describe('Floccus', function() {
})
it('should deduplicate unnormalized URLs', async function() {
const adapter = account.server
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

// create bookmark on server
const serverTree = await getAllBookmarks(account)
Expand Down Expand Up @@ -1049,9 +1013,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.type === 'nextcloud-bookmarks' && (APP_VERSION !== 'stable' && APP_VERSION !== 'master' && APP_VERSION !== 'stable3')) {
this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

// create bookmark locally
const localRoot = account.getData().localRoot
Expand Down Expand Up @@ -1112,9 +1073,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -1175,9 +1133,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -1245,10 +1200,6 @@ describe('Floccus', function() {
)
})
it('should handle strange characters well', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo!"§$%&/()=?"',
Expand Down Expand Up @@ -1298,9 +1249,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -1339,9 +1287,6 @@ describe('Floccus', function() {
return this.skip()
}
const adapter = account.server
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -1419,10 +1364,6 @@ describe('Floccus', function() {
}
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -1478,10 +1419,6 @@ describe('Floccus', function() {
it('should move items successfully even into new folders', async function() {
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -1564,10 +1501,6 @@ describe('Floccus', function() {
it('should move items successfully when mixing creation and moving (1)', async function() {
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -1673,10 +1606,6 @@ describe('Floccus', function() {
it('should move items successfully when mixing creation and moving (2)', async function() {
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const aFolder = await browser.bookmarks.create({
title: 'a',
parentId: localRoot
Expand Down Expand Up @@ -1811,10 +1740,6 @@ describe('Floccus', function() {
}
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const aFolder = await browser.bookmarks.create({
title: 'a',
parentId: localRoot
Expand Down Expand Up @@ -1889,9 +1814,6 @@ describe('Floccus', function() {
const localRoot = account.getData().localRoot

const adapter = account.server
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const aFolder = await browser.bookmarks.create({
title: 'a',
Expand Down Expand Up @@ -2007,10 +1929,6 @@ describe('Floccus', function() {
this.skip()
}

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
Expand Down Expand Up @@ -2061,10 +1979,6 @@ describe('Floccus', function() {
}
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -2152,10 +2066,6 @@ describe('Floccus', function() {
}
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -2286,10 +2196,6 @@ describe('Floccus', function() {
}
const localRoot = account.getData().localRoot

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: localRoot
Expand Down Expand Up @@ -2390,10 +2296,6 @@ describe('Floccus', function() {
await account.setData({...account.getData(), localRoot: root.id})
account = await Account.get(account.id)

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const barFolder = await browser.bookmarks.create({
title: 'bar',
parentId: root.children[0].id
Expand Down Expand Up @@ -2439,10 +2341,6 @@ describe('Floccus', function() {
account = await Account.get(account.id)
const adapter = account.server

expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

let bookmark
let serverTree = await getAllBookmarks(account)
await withSyncConnection(account, async() => {
Expand Down Expand Up @@ -2502,9 +2400,6 @@ describe('Floccus', function() {
if (ACCOUNT_DATA.type === 'linkwarden') {
return this.skip()
}
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
Expand Down Expand Up @@ -4855,10 +4750,6 @@ describe('Floccus', function() {
await account.delete()
})
it('should create local tabs on the server', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

browser.tabs.create({
index: 1,
url: 'https://floccus.org/#test1'
Expand Down Expand Up @@ -4891,10 +4782,6 @@ describe('Floccus', function() {
)
})
it('should create server bookmarks as tabs', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const adapter = account.server
const serverTree = await getAllBookmarks(account)
let windowFolderId, serverMark
Expand Down Expand Up @@ -4937,10 +4824,6 @@ describe('Floccus', function() {
)
})
it('should update the server when pushing local changes', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

await account.setData({...account.getData(), strategy: 'overwrite'})

browser.tabs.create({
Expand Down Expand Up @@ -4999,10 +4882,6 @@ describe('Floccus', function() {
)
})
it('should update local tabs when pulling server changes', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const adapter = account.server
const serverTree = await getAllBookmarks(account)
let windowFolderId, serverMark, serverMarkId
Expand Down
Loading