50 srv.registerDirectory(
"/",
dir);
52 var nameDir = do_get_file(
"data/name-scheme/");
53 srv.registerDirectory(
"/bar/", nameDir);
61 srv.stop(
function() { do_test_finished(); });
69 dir =
Cc[
"@mozilla.org/file/directory_service;1"]
70 .getService(
Ci.nsIProperties)
71 .get(
"TmpD",
Ci.nsIFile);
72 dir.append(
"index_handler_test_" + Math.random());
73 dir.createUnique(
Ci.nsIFile.DIRECTORY_TYPE, 0744);
96 var subdir =
dir.clone();
101 makeFile(
"aa_dir",
true, subdir, files);
102 makeFile(
"b_dir",
true, subdir, files);
103 makeFile(
"AA_file.txt",
false, subdir, files);
104 makeFile(
"test.txt",
false, subdir, files);
124 var parser =
Cc[
"@mozilla.org/xmlextras/domparser;1"]
125 .createInstance(
Ci.nsIDOMParser);
132 var
doc = parser.parseFromString(data,
"application/xml");
136 do_throw(
"document failed to parse as XML");
143 var body =
doc.documentElement.getElementsByTagName(
"body");
148 var
header = body.QueryInterface(
Ci.nsIDOMElement)
149 .getElementsByTagName(
"h1");
155 var lst = body.getElementsByTagName(
"ol");
157 var items = lst.item(0).QueryInterface(
Ci.nsIDOMElement)
158 .getElementsByTagName(
"li");
160 var
ios =
Cc[
"@mozilla.org/network/io-service;1"]
161 .getService(
Ci.nsIIOService);
167 {
name:
"SHOULD_SEE_THIS.txt^", isDirectory:
false}];
169 for (var
i = 0;
i < items.length;
i++)
171 var link = items.item(
i)
174 .QueryInterface(
Ci.nsIDOM3Node)
175 .QueryInterface(
Ci.nsIDOMElement);
176 var f = dirEntries[
i];
178 var sep = f.isDirectory ?
"/" :
"";
182 uri = ios.newURI(link.getAttribute(
"href"),
null,
top);
208 var parser =
Cc[
"@mozilla.org/xmlextras/domparser;1"]
209 .createInstance(
Ci.nsIDOMParser);
216 var
doc = parser.parseFromString(data,
"application/xml");
220 do_throw(
"document failed to parse as XML");
227 var body =
doc.documentElement.getElementsByTagName(
"body");
232 var
header = body.QueryInterface(
Ci.nsIDOMElement)
233 .getElementsByTagName(
"h1");
239 var lst = body.getElementsByTagName(
"ol");
241 var items = lst.item(0).QueryInterface(
Ci.nsIDOMElement)
242 .getElementsByTagName(
"li");
244 var
ios =
Cc[
"@mozilla.org/network/io-service;1"]
245 .getService(
Ci.nsIIOService);
249 for (var
i = 0;
i < items.length;
i++)
251 var link = items.item(
i)
254 .QueryInterface(
Ci.nsIDOM3Node)
255 .QueryInterface(
Ci.nsIDOMElement);
258 var sep = f.isDirectory ?
"/" :
"";
262 uri = ios.newURI(link.getAttribute(
"href"),
null,
top);
274 var type =
Ci.nsIFile[isDirectory ?
"DIRECTORY_TYPE" :
"NORMAL_FILE_TYPE"];
275 var
file = parentDir.clone();
280 file.create(type, 0755);
281 lst.push({
name:
name, isDirectory: isDirectory});
294 test =
new Test(
"http://localhost:4444/",
299 do_check_eq(ch.getResponseHeader(
"Content-Type"),
"text/html");
308 test =
new Test(
"http://localhost:4444/foo/",
318 test =
new Test(
"http://localhost:4444/bar/folder^/",
function createTestDirectory()
do_check_eq(typeof PlacesUtils,"object")
function stopTrailingCaretDirectory(ch, cx, status, data)
function doc() browser.contentDocument
function runHttpTests(testArray, done)
function stopFooDirectory(ch, cx, status, data)
function destroyTestDirectory()
function makeFile(name, isDirectory, parentDir, lst)
function Test(path, initChannel, onStartRequest, onStopRequest)
function hiddenDataCheck(bytes, uri, path)
function stopRootDirectory(ch, cx, status, data)
function dataCheck(bytes, uri, path, dirEntries)
_getSelectedPageStyle s i