Closed Bug 362552 Opened 18 years ago Closed 15 years ago

bookmark loses name for some JavaScript bookmarks with no error

Categories

(Firefox :: Bookmarks & History, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: info, Unassigned)

Details

(Keywords: dataloss, regression)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061201 Minefield/3.0a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061201 Minefield/3.0a1

I have a bookmark in my Bookmarks toolbar that creates Technorati tags.  Its name always reverts to blank when I restart Minefield.  My other bookmarklets with bits of JavaScript (e.g. post to del.icio.us) don't have this problem.  But I get no error report on editing the bookmark, exiting the browser, or restart.

Reproducible: Always

Steps to Reproduce:
1.  Right-click in Bookmarks toolbar, choose New Bookmark...
2.  Create new bookmark with
   Name: TEST NAME,
   Location: (paste in next line only, all one line)
javascript:(function(){var a='';var t=prompt('Enter Tags:','');var tr=t.split(' ');a+='<span class='+unescape('%22')+'technoratitag'+unescape('%22')+'>Categories:<a href=%22http://www.technorati.com/tag/skierpage%22> </a>';for(var i=0;i<tr.length;i++){if(i > 0){a+=', ';}a+='<a href='+unescape('%22')+'http://del.icio.us/skierpage/'+tr[i]+unescape('%22')+' rel='+unescape('%22')+'tag'+unescape('%22')+'>'+tr[i]+'</a>';}a+='</span>';prompt('Copy this code, press OK, then paste to your blog entry:',a);})()
   Keyword: testkw
   Description: Problem with this bookmark?
3. Click the bookmark (It pops up a dialog, enter "blabla", it creates some HTML that you can copy; just click OK to dismiss).
4. Note no errors in Tools > Error Console.
5. Exit browser
6. Restart browser
Actual Results:  
The name is gone!  The button is still there and works, and in bookmark Properties the location, description, and keyword are all still there.

After restoring the name in Properties, I exported my bookmarks from Organize Bookmarks and the bookmark's name is present between the opening and closing <DT> tag.  But when I later looked at my bookmarks.html in my profile, it was missing.  I renamed the exported bookmarks file as xml and loaded in the browser and the browser complained about i<u.length in the JavaScript not being well-formed.

Expected Results:  
Don't lose the name.
(And, if the JavaScript is bad, then warn at some point.
And maybe avoid problems by wrapping bits of JavaScript in CDATA blocks?)

Bugzilla has bugs about bookmark renaming and blank bookmarks, maybe those cases are also due to unexpected JavaScript.
I played around some more:
a) The bookmark name remains within in the <DT> tag in my profile's bookmarks.html after the FIRST restart, even though the browser doesn't show it.  I think the name only disappears from my bookmarks.html when I make a change to any bookmark, or the NEXT time I restart Firefox.

b) The problem isn't as simple as the un-well-formed JavaScript containing '>'; a simpler bookmark with
  javascript:(function(){var a='foo';for(var i=0;i<2;i++){alert(%22foo%22 + i);}})()
has the same well-formed error if loaded as XML, yet doesn't lose its name.
This has happened to me, too.  Of the 25 or so bookmarklets I have in Firefox, 3 of them lost their titles.  I'm using Firefox trunk on Mac OS X.
Keywords: regression
Confirmed in "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061212 Minefield/3.0a1".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: dataloss
Could be caused by the </a> tag.
I had a few bookmarklets from which the name kept disappearing after restarting Firefox although the name was saved in bookmarks.html.
'Masking' the </a> tag like "<"+"/a>" worked and the name stayed.

See: http://forums.mozillazine.org/viewtopic.php?t=537547

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a3) Gecko/20070322 GranParadiso/3.0a3
dickvl, your workaround worked around the problem for me, thanks!!  Still, complex JS bookmarks shouldn't silently screw up, so I hope experts fix this.
Version: unspecified → Trunk
this WFM
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090603 Minefield/3.6a1pre
Feel free to reopen if you can reproduce in current trunk/1.9.1branch.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.