Closed Bug 283734 Opened 20 years ago Closed 6 years ago

should not canonize string if contains spaces inside word

Categories

(Firefox :: Address Bar, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: nrlz, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

SUGGESTION
The "canonizeUrl()" method (which appends "http://www." + ".com/" to strings)
should not canonize a URL if it contains spaces inside the string other than
beginning and trailing spaces.

REASON
This makes it easier for people who paste text from the clipboard (CTRL+V) into
the address bar and want to perform a (keyword/Google) search. Sometimes they
type too fast and press ENTER before releasing the CTRL key. (See steps to
reproduce.)

FIX
This can be fixed on the following line inside "browser.jar!/browser.js"

====
function canonizeUrl(aTriggeringEvent, aPostDataRef)
{
  if (!gURLBar)
    return;
  
  var url = gURLBar.value;

  // Prevent suffix when already exists www , http , /
- if (!/^(www|http)|\/\s*$/i.test(url)) {
+ if (!/^(www|http)|\/\s*$|\S\s+\S/i.test(url)) {


Reproducible: Always

Steps to Reproduce:
Go to the address bar...

1. TYPE "dict "
2. press CTRL
3. press "v"
4. release "v" //pastes clipboard contents
5. press ENTER
6. release CTRL

--OR--

1. ensure clipboard contains, "what is the capital of england?"
2. press CTRL
3. press "v"
4. release "v" //pastes clipboard contents
5. press ENTER
6. release CTRL
RFC2396 tells us that "In some cases, extra whitespace (spaces, linebreaks,
tabs, etc.) may need to be added to break long URI across lines. The whitespace
should be ignored when extracting the URI" and that "software that accepts
user-typed URI should attempt to recognize and strip both delimiters and
embedded whitespace."
Mass edit: Changing QA to default QA Contact
QA Contact: davidpjames → password.manager
Mass edit: Setting correct QA for location bar/autocomplete. My bad. I forgot I had once been Autocomplete QA too. Hmm, why can't I just set the QA of bugs to the default QA of the component in a mass edit rather than having to do it manually...?
QA Contact: password.manager → location.bar
Assignee: bugs → nobody
Could someone please review this bug?  I confirm that said behaviour exists.

Steps to reproduce:
1. type "this is a cat" somewhere and copy it
2. in an empty firefox location bar paste using ctrl+v (do not release ctrl)
3. while still holding ctrl, press enter

Results:
A google search is returned for "http://www.this is a cat.com"
Status: UNCONFIRMED → NEW
Ever confirmed: true
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.