Fix wrong item type for roots in maintenance

RESOLVED INCOMPLETE

Status

()

Firefox
Bookmarks & History
--
major
RESOLVED INCOMPLETE
8 years ago
7 months ago

People

(Reporter: Andreas Jung, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [investigate shortcuts creation])

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0b8pre) Gecko/20101117 Firefox/4.0b8pre
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b8pre) Gecko/20101117 Firefox/4.0b8pre

In one of my bookmark folders there is an invalid entry that can not be deleted.
Because of it, it is also not possible to move or delete the whole folder.

In the error console the following errors are logged:

Error: aUrlString is null 
Source File: resource:///modules/PlacesUIUtils.jsm
Line: 938

Error: uncaught exception: [Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsINavBookmarksService.getBookmarkURI]"  nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)"  location: "JS frame :: chrome://browser/content/places/editBookmarkOverlay.js :: EIO_initPanel :: line 168"  data: no]

Error: uncaught exception: [Exception... "Must have a non-null string spec or nsIFile object"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/PlacesUtils.jsm :: PU__uri :: line 165"  data: no]

Error: uncaught exception: [Exception... "'Illegal value' when calling method: [nsIController::doCommand]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://browser/content/places/controller.js :: goDoPlacesCommand :: line 1654"  data: no]

If there are invalid entries (in this case with no / an invalid URI) it should be still possible to delete them.

Reproducible: Always
(Reporter)

Comment 1

8 years ago
Created attachment 491506 [details]
Screenshot of the folder

The "Unsorted Bookmarks" entry on the right causes the problems...
Do you use Xmarks, or Sync, or any other extension that syncs your bookmarks? Any other external software that could touch your bookmarks or history?

Open the Error console, in the eval field paste the following code and click Eval:
Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm");PlacesDBUtils.checkAndFixDatabase();

Wait a couple minutes, then check again if the entry has been corrected.
(Reporter)

Comment 3

8 years ago
(In reply to comment #2)
> Do you use Xmarks, or Sync, or any other extension that syncs your bookmarks?
> Any other external software that could touch your bookmarks or history?
No, I don't use synchronization software or other software that touches bookmarks or history. 

> Open the Error console, in the eval field paste the following code and click
> Eval:
> Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm");PlacesDBUtils.checkAndFixDatabase();
> 
> Wait a couple minutes, then check again if the entry has been corrected.
Doesn't work.
(Reporter)

Comment 4

8 years ago
Created attachment 491522 [details]
The entry that causes the problem

Using SQLite Manager I found the entry that causes the problems.

Changing type=2 and parent=1, seems to fix the problem.
I don't know if that's the correct fix, but it at least works.

(I first tried to just delete that entry, but that breaks everything.)
(In reply to comment #3)
> Doesn't work.

what does this mean?
did you see result log of the method in the console?
did you see errors instead?
you saw correct results in the error console but the entry is still there?
Did you ever manually edited places.sqlite like you did in comment 4?
What seem to have happened is that "something" has moved your "unsorted bookmarks" folder to the toolbar.
If you don't recall having tried to do that, or having installed any add-on that could have tried to do that, then I'm really surprised it happened. I know some user tried to do that move in "fancy" ways.
(Reporter)

Comment 7

8 years ago
(In reply to comment #5)
> what does this mean?

It showed the result log(*), but didn't fix the incorrect entry.

(In reply to comment #6)
> Did you ever manually edited places.sqlite like you did in comment 4?
> What seem to have happened is that "something" has moved your "unsorted
> bookmarks" folder to the toolbar.

No, I never manually edited places.sqlite, but I think I have found a way to reproduce the bug. (I just have to verify again.) Moving was the right hint.

-----------
(*)
INTEGRITY
ok
- - -
CLEANUP
- - -
EXPIRE
Current unique URIs limit: 32198
- - -
VACUUM
places.sqlite: 20971520 byte
- - -
STATS
places.sqlite: 20971520 byte
moz_bookmarks: 2622
moz_bookmarks_roots: 5
moz_keywords: 4
sqlite_sequence: 1
moz_favicons: 1510
moz_annos: 2096
moz_anno_attributes: 11
moz_items_annos: 1269
moz_places: 32118
moz_historyvisits: 37268
moz_inputhistory: 695
- - -
ok, if you can figure out steps to reproduce, that will greatly help.
(Reporter)

Comment 9

8 years ago
Steps to reproduce:
1) Create a new profile
2) Install SQLite Manager
3) Open SQLite Manager
4) Open the places.sqlite of the new profile
   In moz_bookmarks, there should be the entry:
   id	type	fk	parent	position	title 			[...]
   5	2	NULL	1	3		Unsorted Bookmarks 	[...]
5) Close SQLite Manager
6) Open the Library
7) Open the "Mozilla Firefox" folder
8) Create a new bookmark
   Name: [doesn't matter]
   Location: "place:folder=UNFILED_BOOKMARKS" (without quotation marks)
9) Restart Firefox and open the Library again
10)Drag the in 8) created bookmark/folder onto "Bookmarks Menu"
   Now there should be a "Unsorted Bookmarks" folder inside of "Bookmarks Menu"
11)Open the places.sqlite in SQLite Manager again
   In moz_bookmarks, there is now the entry:
   id	type	fk	parent	position	title 			[...]
   5	2	NULL	2	4		Unsorted Bookmarks	[...]

In my case type was changed to 1 as seen in attachment 491522 [details]; this doesn't happen with these steps to reproduce.

These steps to reproduce still explain how the parent changed.
I'll see what I can debug with these steps. indeed the biggest issue is the type, it's unclear in both cases (you create a bookmark that is a shortcut, it should either be type 1 with a fk, or type 2 without a fk, not something in the middle)
Assignee: nobody → mak77
Whiteboard: [investigate shortcuts creation]
(Reporter)

Comment 11

8 years ago
Have you been successful to reproduce the parent change with the steps in comment 9?
honestly I've not yet tried, this is not a top-priority atm (we have a release to finish), but I've assigned it to me to not lose it, since I want to double check what we are doing in this specific case.

Updated

7 years ago
Version: unspecified → Trunk
(Reporter)

Comment 13

7 years ago
Do you have some time now to try to reproduce it?

I know it isn't a bug that is easy to hit, but if you get this bug it is pretty bad, because the only way to fix it seems to be to manually edit the places.sqlite and this is something most users won't be able to do.
Sorry for late.
So the change of parent on your id=5 is unwanted, this is bug 435851 and happens, for example, dragging a folder shortcut in the left pane of the organizer.
At that point, you have a root in a weird position, but this doesn't explain how it may change its type. What I can explain is why the mess is not fixed by maintenance, indeed in maintenance, as a safety measure, we never touch roots types.

All of this is only useful to explain half of the bug, I can't think of a way to have a root folder changing type from 2 to 1 (but we can have maintenance fix those!)
Status: UNCONFIRMED → NEW
Depends on: 435851
Ever confirmed: true
Summary: Invalid and undeletable entry in a folder in library → Fix wrong item type for roots in maintenance
off my plate for now, feel free to take this bug if you wish.
Assignee: mak77 → nobody

Updated

7 months ago
Status: NEW → RESOLVED
Last Resolved: 7 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.