Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: netwerk/test/unit/xpcshell.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
/*
* Test that default uri is bypassable by an unknown protocol that is
* present in the bypass list (and the pref is enabled)
*/
"use strict";
function inChildProcess() {
return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
}
function run_test() {
// In-Parent-only process pref setup
if (!inChildProcess()) {
Services.prefs.setBoolPref("network.url.useDefaultURI", true);
Services.prefs.setBoolPref(
"network.url.some_schemes_bypass_defaultURI_fallback",
true
);
Services.prefs.setCharPref(
"network.url.simple_uri_schemes",
"simpleprotocol,otherproto"
);
}
// check valid url is fine
// nsStandardURL removes second colon when nesting protocols
// defaultUri removes second colon
// no-bypass protocol uses defaultURI
// simpleURI keeps the second colon
// an unknown protocol in the bypass list will use simpleURI
// despite network.url.useDefaultURI being enabled
let uri3 = NetUtil.newURI(same);
Assert.equal(uri3.spec, same); // simple uri keeps second colon
// setCharPref not accessible from child process
if (!inChildProcess()) {
// check that pref update removes simpleprotocol from bypass list
Services.prefs.setCharPref("network.url.simple_uri_schemes", "otherproto");
// check that spaces are parsed out
Services.prefs.setCharPref(
"network.url.simple_uri_schemes",
" simpleprotocol , otherproto "
);
}
}