Open Bug 233405 Opened 21 years ago Updated 2 years ago

nsDefaultURIFixup should accept forward slashes on win32 (e.g. "c:/boot.ini")

Categories

(Core :: DOM: Navigation, enhancement)

x86
Windows 2000
enhancement

Tracking

()

People

(Reporter: patrick, Unassigned)

References

()

Details

(Whiteboard: [patch] p-iewin)

Attachments

(1 file)

The URIFixup method used by Firebird and Mozilla should allow the user to type 
win32 file paths with forward slashes and rewrite it as the appropriate file:// 
URL.

IE allows this; I don't know about other browsers.

Steps to reproduce:
1. Type "c:/boot.ini" into the location bar.
2. You should see "file:///c:/boot.ini" in the location bar, and the content of 
the file in the display pane.
Whiteboard: p-iewin
I tried to write this patch so that it
A) used the latest nsACString methods
B) was least impact on the code

Things I could do to the patch:
* don't use iterators, use old-fashioned nsACString methods instead
* avoided nsCAutoString local copy of aIn unless absolutely necessary by using
a pointer instead:

   nsCAutoString localUri;
   nsACString *pUri = aIn;
[..]
   if (replacingStuff) {
       localUri.assign(aIn);
       // ...do search & replace...
       pUri = &localUri;
   }

If there is interest in these alternative approaches, let me know.
Assignee: location-bar → patrick
Status: NEW → ASSIGNED
Attachment #140849 - Flags: review?(adamlock)
Here is my list of tests for this patch:

  test cases: (windows)
     c:/boot.ini          ==> file:///c:/boot.ini
     c://boot.ini         ==> c://boot.ini  (fails, unsup protocol)
     c:\\boot.ini         ==> file:///c://boot.ini
     e:/home/.profile     ==> file:///e:/home/.profile
     e:/home              ==> file:///e:/home/
     e:/home/             ==> file:///e:/home/
     c:                   ==> file:///c:/
     c:/                  ==> file:///c:/
     c:\                  ==> file:///c:/
     e                    ==> http://e/
     x:                   ==> file:///x:/
     e:foo                ==> file:///e:foo
     
  test cases: (unix)
     /etc/passwd          ==> file:///etc/passwd
     /                    ==> file:///
Comment on attachment 140849 [details] [diff] [review]
nsDefaultURIFixup patch

Note that the original code checked for both a colon or pipechar in the second
position.  My new code does not check for the pipechar, because this is a minor
bug in the old code.

Using a pipechar as a drive separator is a legal URL convention, but it is not
a legal Windows way to specify a drive letter.	With the code as it stands you
could type:

c|boot.ini

and the fixup code would look for the file "c|boot.ini", which even if it
existed would not be what you want.
Whiteboard: p-iewin → [patch] p-iewin
==> docshell
Component: Location Bar → Embedding: Docshell
QA Contact: adamlock
QA Contact: adamlock → docshell
Gavin, do we still care about this patch?
Comment on attachment 140849 [details] [diff] [review]
nsDefaultURIFixup patch

No idea! Comment 0 sounds like a reasonable request, assuming it still applies. This patch no longer applies cleanly, unfortunately.
Attachment #140849 - Flags: review?(adamlock)

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: patrick → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: