canonizeUrl() ignores appended directories

RESOLVED FIXED in Firefox 2 beta1

Status

()

Firefox
Location Bar
--
enhancement
RESOLVED FIXED
13 years ago
11 years ago

People

(Reporter: Michael Parker, Assigned: Peter Kasting)

Tracking

({fixed1.8.1})

unspecified
Firefox 2 beta1
x86
Windows XP
fixed1.8.1
Points:
---
Bug Flags:
blocking-firefox2 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

13 years ago
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

The canonizeUrl() function in browser.js is responsible for automatically adding
the "http://" prefix and ".com", ".net", or ".org" suffixes to what is typed in
the Location bar, depending on what keyboard shortcut is used. This is useless,
however, when the user wishes to also enter some subdirectory or specify a
remote file for viewing (e.g., "google/scholar" + Ctrl + Enter should generate
"www.google.com/scholar" [subdirectory], and "google/images/logo.gif" + Ctrl +
Enter should generate "http://www.google.com/images/logo.gif").

Reproducible: Always

Steps to Reproduce:
1. Type in an domain name without its accompanying "http://www." prefix or
".com" suffix, followed by a slash and a directory name or file 
2. Hit CTRL + Enter

Actual Results:  
The resulting URL has its ".com" suffix appended after the directory name or
file, ont before

Expected Results:  
The resulting URL should have its ".com" suffix placed before the first slash
and the directory name or file
(Reporter)

Comment 1

13 years ago
Created attachment 171801 [details] [diff] [review]
fix to provide new functionality

This is from a diff from the browser.js file in the Firefox 1.0 source
(Reporter)

Comment 2

13 years ago
Comment on attachment 171801 [details] [diff] [review]
fix to provide new functionality

1872a1873
>       
1874c1875,1878
<	url = "http://www." + url + suffix;
---
>       var firstSlash = url.indexOf("/");
>       if (firstSlash < 0)
>         firstSlash = url.length;
>       url = "http://www." + url.substring(0, firstSlash) + suffix + url.substring(firstSlash, url.length);

Updated

12 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

12 years ago
Attachment #171801 - Attachment is patch: true
Attachment #171801 - Flags: review?

Comment 3

12 years ago
for kicks, this should work:

url = url.replace(/(^[^\/]*)(|\/)/, "http://www.$1"+suffix+"$2");

Updated

11 years ago
Attachment #171801 - Flags: review? → review?(mconnor)

Comment 4

11 years ago
WORKAROUND: The Autocomplete Manager extension (https://addons.mozilla.org/extensions/moreinfo.php?id=2300) includes a bugfix for this.
(Assignee)

Comment 5

11 years ago
Taking with hopes of updating the patch here.
Assignee: bugs → pkasting
(Assignee)

Comment 6

11 years ago
Created attachment 221397 [details] [diff] [review]
Updated patch

I made one change to the original patch to prevent the suffix insertion from resulting in two slashes (which is a different URL).  This is a patch against the trunk.
Attachment #171801 - Attachment is obsolete: true
Attachment #221397 - Flags: review?(mconnor)
Attachment #171801 - Flags: review?(mconnor)
(Assignee)

Comment 7

11 years ago
Nominating for Fx2 B1.  This is a small patch that makes our behavior a little less braindead.
Flags: blocking-firefox2?
(Assignee)

Comment 8

11 years ago
Adding a target milestone to increase likelihood of search queries finding me
Target Milestone: --- → Firefox 2 beta1

Updated

11 years ago
Attachment #221397 - Flags: review?(mconnor)
Attachment #221397 - Flags: review+
Attachment #221397 - Flags: approval-branch-1.8.1+

Updated

11 years ago
Status: NEW → ASSIGNED
Flags: blocking-firefox2? → blocking-firefox2+

Comment 9

11 years ago
Created attachment 225803 [details] [diff] [review]
Patch as checked in: adding missing semicolons

The curious part is that it built and ran just fine without these semicolons, but it seems poor form to omit them nonetheless.
Attachment #221397 - Attachment is obsolete: true

Comment 10

11 years ago
fixed-1.8-branch, fixed-on-trunk
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
*** Bug 259707 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.