Exporting bookmarks to HTML adds some data, might result in file which can't be imported

NEW
Unassigned

Status

()

Firefox
Bookmarks & History
3 years ago
2 years ago

People

(Reporter: Paweł S., Unassigned)

Tracking

38 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

3 years ago
Created attachment 8625570 [details]
testbookmark.html

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150525141253

Steps to reproduce:

Used Bookmarks menu to export bookmarks to HTML file on one computer.
On the other, couldn't import said file by using Import from HTML option. Happens on two separate computers.


Actual results:

The file has additional data (Visual Studio Project File description, some other "random" data) in header which makes Firefox unable to import bookmarks from HTML file. There is no error, just nothing happens.
When using browser console it results in following errors:

"01:34:00.086 Failed to import bookmarks from file:///C:/Users/Pawel/Desktop/testbookmark.html: [Exception... "Component returned failure code: 0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS) [nsINavBookmarksService.runInBatchMode]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource://gre/modules/BookmarkHTMLUtils.jsm :: walkTreeForImport :: line 934"  data: no]1 BookmarkHTMLUtils.jsm:159:0"

 "01:34:00.087 [Exception... "Component returned failure code: 0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS) [nsINavBookmarksService.runInBatchMode]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource://gre/modules/BookmarkHTMLUtils.jsm :: walkTreeForImport :: line 934"  data: no]1 Promise-backend.js:870:0
"


Expected results:

The bookmarks should be imported.
(Reporter)

Comment 1

3 years ago
A word of clarification: both the VS Project stuff references names I personally recognise (names of projects, like "Blackbox") as well as the excerpt which follows (which seems to be a Last.fm shortcut/custom search I made and still use, it is in bookmarks, but it wasn't when I generated the attached .html file).

In my amateur search for cause I tracked the issue down to this line:
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/BookmarkHTMLUtils.jsm#1158

but of course I don't know the project, so it might be false.
Hello,

Is this bug still present in Firefox 42.0 or Nightly 45.0a1?

Thank you,

Justin
Component: Untriaged → Bookmarks & History
Flags: needinfo?(pawelesc2)
(Reporter)

Comment 3

2 years ago
(In reply to Justin - QA from comment #2)
> Hello,
> 
> Is this bug still present in Firefox 42.0 or Nightly 45.0a1?
> 
> Thank you,
> 
> Justin

It seems it's still present in 42.0, also whewn I start it without addons. Nightly 45.0a1 also shows this issue.

There's a twist: when I made a new profile for further testing of Nightly install it exported a legit bookmarks.html file. When I used 42.0 with this new profile - it worked again. To recap:

My main profile:
42.0 - broken
45.0a1 - broken

Clear profile:
42.0 - OK
45.0a1 - OK

So the problem might be present in the bookmarks themselves or other user files, though addons themselves shouldn't affect it because disabling them didn't help.

I don't know the codebase, but still I believe it has something to do with this piece of code:
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/BookmarkHTMLUtils.jsm#1168

_writeDescription: function (aItem, aIndent) {
    let descriptionAnno = aItem.annos &&
                          aItem.annos.find(anno => anno.name == DESCRIPTION_ANNO);
    if (descriptionAnno)
      this._writeLine(aIndent + "<DD>" + escapeHtmlEntities(descriptionAnno.value));


But I don't get why this part in the exported bookmarks.html:

"<DD>Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 (...)"

happens before first occurence of "<DL><p>", so before the actual bookmarks are listed.
So maybe this line?:
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/BookmarkHTMLUtils.jsm#1064
Flags: needinfo?(pawelesc2)
would you mind sending me privately the places.sqlite file that generates this bookmarks.html file? Sounds like something is very wrong in its structure if it generates such a file...

Are JSON backups working properly at all?
Flags: needinfo?(pawelesc2)
btw, looks like that long string has been set as the description of the bookmarks menu folder, for whatever reason.
(Reporter)

Comment 6

2 years ago
(In reply to Marco Bonardo [::mak] from comment #4)
> would you mind sending me privately the places.sqlite file that generates
> this bookmarks.html file? Sounds like something is very wrong in its
> structure if it generates such a file...
> 
> Are JSON backups working properly at all?

When using the Restore menu (the one which lists dates) - it works OK.

(In reply to Marco Bonardo [::mak] from comment #5)
> btw, looks like that long string has been set as the description of the
> bookmarks menu folder, for whatever reason.

It was in fact description of the Bookmarks Toolbar folder. I deleted it, and now top of exported bookmarks.html file looks like that:

<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
     It will be read and overwritten.
     DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Menu Zakładki</H1>

<DD>
<DL><p>
(...)

And it still doesn't import. When I manually delete the "<DD>" tag - it works - but after that it STILL produces a file with the "<DD>" tag upon exporting. It's same with both 42.0 and Nightly.

Should it be possible at all to add a description to the top folders of Bookmarks (like the Menu and Toolbar ones)? I can access the Properties of the Toolbar folder, but sometimes there's no option for it when right clicking, which is throwing me off further. I went to investigate and will post more details in next reply.
Flags: needinfo?(pawelesc2)
(Reporter)

Comment 7

2 years ago
Created attachment 8697683 [details]
Menu allowing to add description to Bookmarks Menu folder by right clicking on Bookmarks Toolbar folder

Menu allowing to add description to Bookmarks Menu folder by right clicking on Bookmarks Toolbar folder - note, that those are different folders!
(Reporter)

Comment 8

2 years ago
Created attachment 8697684 [details]
Place.sqlite files

Place.sqlite files - before and after adding a description to the Bookmarks Menu folder.
(Reporter)

Comment 9

2 years ago
So I tested it and attached two new files.

I assume, that it shouldn't be possible to add a description to "Bookmarks Menu" folder. But actually I was able to do so, it's displayed on the attached image:
  right clicking on Bookmarks Toolbar
  accessing Properties (here it's "Właściwości")
  adding description and saving
! note, that Bookmarks Toolbar and Bookmarks Menu are two different things, it's shown on the image with red and green !
It seems, that it opens properties of wrong folder. Also, sometimes there's no menu entry for Properties. I actually had to right-click around on other items (folders) for it to appear also for the Toolbar folder. This makes me think, that it shouldn't be possible at all to access Properties menu for the top folders.

After adding the description the Places.sqlite file changes. Both are included as attachments: before and after adding the description. It seems, that this process corrupts the file permanently in a way, that it generates malformed bookmarks.html files. Note, that you can find the description ("TESTDESCRIPTION") itself in the "post" Places.sqlite file. Even if you delete the description from properties, there are traces of it being added before, so it's permanent.
Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.