Closed Bug 395204 Opened 17 years ago Closed 17 years ago

don't strip newlines inside tags when pasting HTML/XML into URL bar

Categories

(Firefox :: Address Bar, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: moz, Unassigned)

References

Details

(Keywords: testcase)

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

Paste something like this into the location bar:

data:text/html,
<BODY  
  bgcolor="red"> Background should be red
</BODY>

or this:

javascript:'<BODY
  bgcolor="lightblue"> Background should be blue </BODY>'

Reproducible: Always

Steps to Reproduce:
Paste the examples above into the URL bar and pess enter.
Actual Results:  
Background is white.

Expected Results:  
Background is coloured.

There should be a space between the tag name and the attribute.
Blocks: 23485
Keywords: testcase
This is such an edge case that it is not worth fixing.  Just edit the text before you paste it in, or write it without a newline after the tag name.  Really, how many people are pasting data or JavaScript URIs into the URL bar on a regular basis?
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
This is absolutely valid bug.

If I copied some text from page and want to paste it into location bar/form field, should I get "HelloWorld!" instead of proper "Hello World?"

In my bug 391936 I wrote that newlines should be replaced by spaces. Because this is sane and natural thing to do. "Natural" of course if you work on *nix and send thru pipes megabytes of texts daily.

Seems like my 391936 was dupped needlessly. Probably I should reopen it.
> This is such an edge case that it is not worth fixing.

What a load of nonsense! If you paste a url into the address bar, you get the newline included, Mozilla can't handle it. Why?

Newlines are not valid in URLs, Mozilla is broken.

Your suggest to paste the url into a text editor, and manually remove the newline, then paste it back into Mozilla to work around this bug is laughable.
(In reply to comment #2)
> This is absolutely valid bug.
> 
> If I copied some text from page and want to paste it into location bar/form
> field, should I get "HelloWorld!" instead of proper "Hello World?"
> 
> In my bug 391936 I wrote that newlines should be replaced by spaces. Because
> this is sane and natural thing to do. "Natural" of course if you work on *nix
> and send thru pipes megabytes of texts daily.

Pasting into the URL bar strips newlines and spaces around them.  Newlines are not valid in URLs, so there is no sense in keeping them.  Replacing them with spaces would still give you a broken URL in most cases.  If you copied "Hello World" and pasted it, you'd get "Hello World".  If you copied "Hello\n World", however, you'd get "HelloWorld".  But really, the primary use case for the URL bar is *URLs*, which shouldn't have spaces or newlines in them.

(In reply to comment #3)
> What a load of nonsense! If you paste a url into the address bar, you get the
> newline included, Mozilla can't handle it. Why?
> 
> Newlines are not valid in URLs, Mozilla is broken.

This is not how this works in trunk Firefox builds.  Please check your facts before making comments like this.

> Your suggest to paste the url into a text editor, and manually remove the
> newline, then paste it back into Mozilla to work around this bug is laughable.

I suggested this to the reporter who was pasting data: URIs containing newlines.  I'm sure this is an ok solution for all 10 people that do that on a regular basis.  Nowhere did I suggest that normal people who encounter a text-wrapped URL should have to copy it to a text editor and edit it.  In fact, I fixed bug 23485 specifically to avoid that case.

If there are specific cases where this functionality falls down in normal use, then we should fix them.  I do not believe this bug, however, is one.  Copying and pasting multi-line data URIs containing HTML tags is not an everyday web activity.
> Newlines are not valid in URLs, so there is no sense in keeping them. 
> Replacing them with spaces would still give you a broken URL in most cases.

Hm. Talk about miscommunication. I'm heavy user of keyword searches. I use copy-pasting into URL bar pretty much exclusively for that purpose. And I was filing my bug more or less having in mind only that. Sorry :(

So from my point of view stripping spaces make no sense. In my experience if URL was put in page as text and was word wrapped, chances are great it is not valid URL anymore: first because it was broken down and some words might not look like part of URL anymore, and second because '&' and '?' (as well as other symbols) are often get garbled.

Though, from your point of view stripping everything makes perfect sense. I can hardly disagree: we try to workaround usual inability of end-users to post links.

Let it be as it is. At least with your change I can have all words I'm trying to paste into location bar what compared to 2.x - first line only - is huge progress.
What about checking whether copy-pasted text looks like link - and stripping everything? Otherwise replace newlines with spaces.

Mozilla already should have function to check if text is link: it is used to validate drag'n'dropped text into location bar and only tab bar.
(In reply to comment #1)
> Really, how many people are pasting data or JavaScript URIs into the URL bar > on a regular basis?

Probably less. I do this sometimes using Opera (works fine there, besides an issue with "#").
Use of data:URIs will increase when IE is fixed.

(In reply to comment #6)
> What about checking whether copy-pasted text looks like link - and stripping
> everything? Otherwise replace newlines with spaces.

I like this proposal.

j.j.
You need to log in before you can comment on or make changes to this bug.