You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


file: URL Test Cases

Abstract:
This document provides file: URL tests in compliance with RFC 1738 and RFC 1630.

Before you start:
This test points to files that should be on a standard installation. In some cases, you need to create an extra test bed of files.
The next re-write will include recommended steps for the location and creation of the test bed. For now, I've tried to provide some general instructions on the creation of the files. Mac OS users need to rename their hard drive (or create a new, small partition) called "Macintosh HD".

Running the test:

Testing file URLs is complicated by the the checkloadURI feature, which disables file: URLs in network served (http: and https:) pages.
The test methodology is to take the test case (a string that could be a file: // URL) and paste it into the Location/URL bar and hit enter.
The fastest way of running the test is to select a URL by double clicking, then use keyboard shortcuts to:
Linux: copy the selection, select and clear the Location URL (control-l + backspace), and hit return).
MacOS/Windows: copy the selection, select the Location URL (control-l or command -l), paste the file: URL, and hit return. 
Scheme tests
URL
Results
Comments
scheme-only
file
-> hostname "file"
  1. -> try http://file.localdomain.tld
  2. -> try http://www.file.com
Normal URL bar handling.
incomplete scheme-only formating
file:
file:/
file://
-> about:blank (Linux: file:///)
-> about:blank (Linux: file:///)
-> about:blank (Linux: file:///)

file: + 0-2 slashes -> "file:///", see 65152
(regression: only Linux works in RC1)
incomplete scheme+path
file:<path>
file:/<path>
Windows:
file:/C:/config.sys
file://C:/config.sys
Mac OS:
file:Macintosh%20HD/fileURLs/text.txt
file:/Macintosh%20HD/fileURLs/text.txt
Linux+Chimera:
file:fileURLs/text.txt
file:/fileURLs/text.txt

-> file:///<path>


Windows: config.sys should exist
MacOS, Linux, Chimera: create fileURLs/text.txt

Schemes with missing "/"s will be corrected when possible (file://<path> cannot be corrected, see below)
minimal URL
file:///

"file:///" displays blank page in Mac OS (X and classic) and Win32 13607
<host> tests


file:// w/ fqdn file://hostname/ A file URL takes the form:

file://<host>/<path>

where <host> is the fully qualified domain name of the system on which the <path> is accessible, and <path> is a hierarchical directory path of the form <directory>/<directory>/.../<name>.
3.10

Expeted result: same as "file:///" (see test above)
<host> is not checked: 70871
localhost file://localhost/  As a special case, <host> can be the string "localhost" or the empty  string; this is interpreted as `the machine from which the URL is being interpreted'.
3.10
Expeted result: same as "file:///" (see test above)
Mac OS X problems: 140606
non-hostname in hostname field
file://<filename>
file://<path>/<path>/<filename>


Since the file URL would accept the first part as a hostname, the file URL is valid, even if the author intended to use "file:///" as the prefix. Only exception is for DOS volumes (see next test)
DOS volume promotion
file://c|
file://c:

file://c|/
file://c:/
-> file:///c|/
-> file:///c:/
-> file:///c|/
-> file:///c:/

DOS volumes are moved from the host field to the first path segment (see 24431). The first two examples also are "/" (see next test)
Problems in Mac/Linux 102724
Path



DOS volume recognition file:///c: 
file:///C:/Program%20Files
-> file:///c:/
-> file:///C:/Program%20Files
adding a trailing "/" happens for DOS volume letters only
Mac OS X will not error: see 128909
"?"
Windows:
file:///c:/?
MacOS:
file:///Macintosh%20HD/fileURLs/?
file:///Macintosh%20HD/fileURLs/testof?.txt
file:///Macintosh%20HD/fileURLs/testof%3F.txt
Linux:
file:///fileURLs/?
file:///fileURLs/testof?.txt
file:///fileURLs/test%3F.txt

check as filename and as character in filename.
Windows: "?" is not allowed in files
Mac/Linux: create a file named "test?.txt"

Problems"?" as path segment Win, Mac OS X 59002
Characters after ? are treated as query, not part of filename
102603
"#"
file:///C:/WINDOWS/Desktop/FileURLs/has%23.txt
file:///Macintosh%20HD/fileURLs/testof%23.txt
file:///Macintosh%20HD/fileURLs/fragment_test.html#here

file:////fileURLs/testof%23.txt
create: "filehas#.txt"
"#" must be escaped, unescaped "#" is a fragment (anchor)
" "
Windows: file:///C:/Program Files

":"
Windows: ":" is invalid
Macintosh OS ":" is invalid
create URL that points to illegal file.

"."
file:///C:/WINDOWS/Desktop/FileURLs/trailing.
file:///Macintosh%20HD/fileURLs/trailing.

create: "trailing."
trailing dot problems 149586 
File Handling

File Handling QA
text Windows:
file:///C:/Autoexec.bat
Linux:
file:///etc/hosts


need sample URL for Mac Classic
other mime typefiletype sniffing Windows:
file:///C:/WINDOWS/Desktop/FileURLs/mozilla-banner
MacOS:
file:///Macintosh%20HD/fileURLs/mozilla-banner
Linux:
file:///fileURLs/mozilla-banner

Save the mozilla-banner (at top of page) to file named "mozilla.banner" w/o a .gif extension
file:// needs decoder to sniff file types (see 83241)
executables file URL that is executable on OS
Windows:
file:///C:/command.com

use:
Mac OS classic file
Mac OS X file

see 59932 (also, MacOS 48165 )
(tries to save in RC1 Win32, Mac OS X classic apps)
Mac OS X apps are directories
User Interface



Reload
any directory
any file
opening file:///C:/, adding file, hit reload shows new files
editing a file and reloading should show new copy
directories had problem, see 90504
View Source
directories
files
<pending html view>
<unknown>
.
blank page, works in Linux
Win32 RC1 attempts to save file
Back + Forward
buttons should work

see Session:History for full testing
Exceptions


non-existent file any file that does not exist.
should provide error message. fixed in
Non-existent DOS drive references do not error.
fixed in 63048
no drive/volume error needed, see 128909

empty file create empty file and open it
Windows: file:///C:/WINDOWS/Desktop/FileURLs/empty

displays empty page, that is not about:blank
Mac OS and Linux users: use "touch emptyfile"
should display only empty page (nothing else), see: 102737
full disk
test w/ floppy

white box problem: 100687
Preferences



file:// links in HTTP document


The file URL scheme is unusual in that it does not specify an Internet protocol or access method for such files; as such, its utility in network protocols between hosts is limited.

security.checkloadURI=true will block file: URLs on network served pages.
use "about:config" to view pref easily
html view

network.dir.format - set to 1 if you want XUL dir.
not working for file yet. bug 10812 (needs qa review)

Results contain some quotes from RFC 1738.

To do:
Re-write test to use a standard testbed of files (and provide instructions for creating them on your local disk). -Windows paths updated, will post file archive soon.
Re-arrange tests to isolate platform specific tests.
Research syntaxtical aspects of local file systems (ongoing)

Last Update:
10.11.2002 - further cleanup of suggested paths