Closed Bug 27039 Opened 25 years ago Closed 25 years ago

Can't maintain a bookmark containing a JavaScript URL

Categories

(SeaMonkey :: Bookmarks & History, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: sfraser_bugs, Assigned: rhp)

References

Details

(Whiteboard: waiting on fix for bug 27430 to verify)

Attachments

(1 file)

I have a personal toolbar bookmark item containing the following URL: javascript:if(sint0002 = prompt('Bug Number:','')) location.href="http:// bugzilla.mozilla.org/show_bug.cgi?id=" + sint0002; I can enter this in the bookmarks properties dialog, and it works the first time I try it in the browser. However, after quit and restart, the url has been truncated to javascript:if(sint0002 = prompt('Bug Number:','')) location.href= and ceases to work.
The problem here appears to be that URLs containing quotes " are mangled. Probably some JS quoting issues.
Simon, I've attached a diff of a proposed fix which will handle URLs with quotes correctly. Care to try it out? That's only part of the fix. In general, I think that nsEscapeHTML() in mozilla/ xpcom/io/nsEscape.cpp needs to escape quotes as well as what it does now for &lt, &gt and &amp, otherwise bookmark descriptions will have the sample problem. rhp, you look like the owner of that function. Opinion(s) ???
Status: NEW → ASSIGNED
Hmmm... might want to delete the last line of the patch: strm << escapedID; as its written out twice. Oops... too much copy/paste'ing.
Blocks: 11417
Target Milestone: M14
Re-assigning to rhp@netscape.com to make nsEscapeHTML() also escape quotes.
Assignee: rjc → rhp
Status: ASSIGNED → NEW
Note: I checked in my changes to bookmarks so that JavaScript URLs with quotes should now work.
Uh...I just brought that over from the 4.x world because I needed it throughout the mail/news back end. I'll look at the code and see what I can do...sounds pretty simple. - rhp
Status: NEW → ASSIGNED
Ok, I think I have a pretty simple fix and I've been testing it with mail display and everything looks fine. I'll check it in when the tree opens. - rhp
Fixed nsEscapeHTML() to escape quotes as well. - rhp
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
sfraser reports that you can hand edit your bookmarks file and have the javascript: url work properly. I'm going to wait on verification however until the bookmarks properties dialog is back up to speed (bug 27430) to check this out fully
Depends on: 27430
Whiteboard: waiting on fix for bug 27430 to verify
VERIFIED fixed with the 2000022808 build on MacOS 8.6
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: