Closed Bug 1272227 Opened 8 years ago Closed 8 years ago

Adding a keyword to a bookmark does not save the keyword

Categories

(Firefox :: Bookmarks & History, defect)

46 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1150678

People

(Reporter: nico, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160502172042

Steps to reproduce:

- Opened a page like https://en.wikipedia.org/wiki/Main_Page
- Clicked the bookmark star right to the URL bar
- Opened the bookmarks sidebar using Ctrl+B
- Searched for the recently added bookmark, opened the edit dialog
- Replaced last part of URL (Main_Page) with %s and added a bookmark keyword to open a wikipedia entry with it
- Clicked save
- Reopened edit dialog


Actual results:

Location was changed properly, keyword field was empty


Expected results:

The keyword field should contain the keyword I entered before saving
Component: Untriaged → Bookmarks & History
If you look at your Browser Console (Tools -> Web Developer -> Browser Console), do you see any errors when trying to set the keyword? E.g.,

NS_ERROR_STORAGE_CONSTRAINT: Component returned failure code: 0x80630003 (NS_ERROR_STORAGE_CONSTRAINT) [nsINavBookmarksService.setKeywordForBookmark]PlacesUtils.jsm:3453
NS_ERROR_STORAGE_CONSTRAINT: Component returned failure code: 0x80630003 (NS_ERROR_STORAGE_CONSTRAINT) [nsITransactionManager.doTransaction]
PlacesUtils.jsm:2043
Status: UNCONFIRMED → NEW
Ever confirmed: true
Looking at my own moz_keywords, it looks like the keyword already exists in moz_keywords; however, the place_id doesn't actually exist in moz_places. I'm guessing somehow foreign_count wasn't set for the bookmark and it got removed?

I believe I ran into this issue when I was updating urls various keyworded bookmarks to use https instead of http. This seems to cause the keyword to disappear from the bookmark, and then trying to re-set the keyword fails.

I'm not sure how to debug what caused the original place_id to disappear, but now that it has, the code doesn't find an `oldUri` because it JOINs ON h.id = place_id returning no rows.

https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsNavBookmarks.cpp#2328-2334

I suppose if it was a `LEFT JOIN`, it'll return a row but no url, so at least it can go down some of the `UPDATE` path instead of `INSERT`.
Flags: needinfo?(mak77)
After doing this, I was able to re-set keywords for all my quick searches that were missing keywords:

DELETE FROM moz_keywords WHERE (SELECT 1 FROM moz_places WHERE id = place_id) IS NULL;
the problem is bug 1150678

The keywords UI is broken, we don't know wheter it's worth fixing it or rather implementing bug 648398 (more future proof)
Flags: needinfo?(mak77)
For anyone else running into this, you might be able to fix this:

1) open up a new tab (about:newtab)
2) open up web console (tools -> web developer -> web console)
3) paste/enter in the console (without the leading ">"):

> Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); PlacesUtils.history.DBConnection.executeSimpleSQL("DELETE FROM moz_keywords WHERE (SELECT 1 FROM moz_places WHERE id = place_id) IS NULL");
Depends on: 1150678
could you please check if this is now fixed by bug 1150678?
Yes, it works correctly now. I'm able to set keywords again for existent bookmarks.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.