Closed Bug 77522 Opened 25 years ago Closed 24 years ago

Newlines in links should be stripped when selecting "Copy Link Location"

Categories

(Core :: DOM: Serializers, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: bugzilla, Assigned: t_mutreja)

References

Details

(Whiteboard: DUPEME [NC][correctness][paste][has-super-review][needs a=])

Attachments

(2 files, 2 obsolete files)

if you have the following in a webpage: <a href="http://www. gemal.dk">gemal.dk</a> that's a newline inside a link, the newline should be killed/stripped when you rightclick on the link and selecting "Copy Link Location" build 20010424 on win2k
Attached file testcase —
testcase created. When you move the cursor over the link the status bar says: "http://www.gemal.dk" but if you rightclick on it and select "Copy Link Location" and paste it into the "Location" field you only get "http://www."
confirmed with build 2001042504 on W2K
Keywords: helpwanted
Target Milestone: --- → mozilla1.0
Status: NEW → ASSIGNED
Whiteboard: [correctness][copy]
here is the issue with this bug, we generally dont want to change data when we copy it. pasting is another story, because pasting is always context sensitive. so I can see wanting to remove the new line when pastinglinks into our app, but certainly not on the copy. changing status whiteboard to reflect this. anthonyd cc'ing pinkerton as he knows a lot about pasting, also, i dont really see how this is an editor bug.
Whiteboard: [correctness][copy] → [NC][correctness][paste]
--> brade
Assignee: anthonyd → brade
Status: ASSIGNED → NEW
the bug belongs to the presShell DoCopy owner. if all the data isn't being put on the clipboard, there's nothing the toolkit can do about it.
also another conclusion pink and I cam to was that copying a link location is not the same thing as copying other text or data. there is no need or expectation to preserve the content mode/layout. there is no real good reason why when pasting a link we dont strip out a newline. anthonyd
newlines should be stripped on copy; I don't expect to get two lines when copying a url from the urlbar and pasting it into notepad or wherever. The URL bar needing to strip newlines on paste is a separate bug. This bug is probably a serializer bug and should go to the module owner for DOM to Text Conversion. However, this particular case is probably that we shouldn't be storing the links with spaces/cr/lf in them. I believe there is a bug for clicking on these links (which won't work either) that this should be duplicated against. dr wrote the Copy Link Location and related methods in the presshell. Let's see if jst knows the bug I am talking about and can dup this bug.
Assignee: brade → jst
Whiteboard: [NC][correctness][paste] → DUPEME [NC][correctness][paste]
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Attached patch Patch for the fix. (obsolete) — — Splinter Review
Attaching the patch for fixing this bug. It checks and removes whitespaces(if any) in the URL, while copying itself.
I hope this doesn't remove %20 from the URL's, because a lot of windows URLs contain whitespace in them (in mozilla they have to be indicated as %20 or something like that)
I have the same concern as Fabian. Tanu, can you see what happens with your patch in the case of links that contain spaces inside them. You might need to modify your patch such that only newlines and tabs are stripped, not spaces. Re-assigning this bug to you. Thanks for jumping in on this!
Assignee: jst → tmutreja
Don't we already have code that deals with stripping whitespace when you click on a link? Couldn't that code be reused here?
Attached patch Modified Patch. (obsolete) — — Splinter Review
Updating the fix for removing only tabs, cr and lf.
Keywords: helpwanted → patch
Whiteboard: DUPEME [NC][correctness][paste] → DUPEME [NC][correctness][paste][patch needs r/sr=]
Status: NEW → ASSIGNED
Target Milestone: mozilla1.0.1 → mozilla1.0
Comment on attachment 64662 [details] [diff] [review] Modified Patch. sr=jst if you make |strippedChars| static.
Comment on attachment 64662 [details] [diff] [review] Modified Patch. sr=jst if you make |strippedChars| static.
Attachment #64662 - Flags: superreview+
Changed |strippedChars| to be static.
Attachment #64511 - Attachment is obsolete: true
Attachment #64662 - Attachment is obsolete: true
Whiteboard: DUPEME [NC][correctness][paste][patch needs r/sr=] → DUPEME [NC][correctness][paste][has-super-review][needs r=/a=]
Comment on attachment 64662 [details] [diff] [review] Modified Patch. r=harishd
Attachment #64662 - Flags: review+
This static char strippedChars[] = {'\t','\r','\n'}; could also be written as static char strippedChars[] = "\t\r\n"; I believe. But no biggie.
Whiteboard: DUPEME [NC][correctness][paste][has-super-review][needs r=/a=] → DUPEME [NC][correctness][paste][has-super-review][needs a=]
Comment on attachment 72947 [details] [diff] [review] Including jst's comments... a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #72947 - Flags: approval+
Fixed with checkin D:\mozilla\layout\html\base\src>cvs commit cvs commit: Examining . Checking in nsPresShell.cpp; /cvsroot/mozilla/layout/html/base/src/nsPresShell.cpp,v <-- nsPresShell.cpp new revision: 3.517; previous revision: 3.516 done
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
v 20020320
Status: RESOLVED → VERIFIED
Depends on: 377392
(In reply to comment #20) > This > > static char strippedChars[] = {'\t','\r','\n'}; > > could also be written as > > static char strippedChars[] = "\t\r\n"; > > I believe. But no biggie. Actually, it is. See bug 377392.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: