зеркало из https://github.com/mozilla/gecko-dev.git
Unit testcase for bug 337744, r=darin
This commit is contained in:
Родитель
5e11811d66
Коммит
bfcb485faf
|
@ -0,0 +1,34 @@
|
|||
/* verify that certain invalid URIs are not parsed by the resource
|
||||
protocol handler */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
|
||||
const specs = [
|
||||
"resource:////",
|
||||
"resource:///http://www.mozilla.org/",
|
||||
"resource:///file:///",
|
||||
];
|
||||
|
||||
function check_for_exception(spec)
|
||||
{
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
try {
|
||||
var channel = ios.newChannel(spec, null, null);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_throw("Succesfully opened invalid URI: '" + spec + "'");
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
for each (spec in specs) {
|
||||
check_for_exception(spec);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче