зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353429: Test Principal URI escaping.r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D66997 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3d7a2ce032
Коммит
2244f338fc
|
@ -0,0 +1,29 @@
|
|||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var ssm = Services.scriptSecurityManager;
|
||||
|
||||
function makeURI(uri) {
|
||||
return Services.io.newURI(uri);
|
||||
}
|
||||
|
||||
function createPrincipal(aURI) {
|
||||
try {
|
||||
var uri = makeURI(aURI);
|
||||
var principal = ssm.createContentPrincipal(uri, {});
|
||||
return principal;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
Assert.equal(createPrincipal("http://test^test/foo^bar#x^y"), null);
|
||||
|
||||
Assert.equal(createPrincipal("http://test^test/foo\\bar"), null);
|
||||
|
||||
Assert.equal(createPrincipal("http://test:2^3/foo\\bar"), null);
|
||||
|
||||
Assert.equal(
|
||||
createPrincipal("http://test/foo^bar").exposableSpec,
|
||||
"http://test/foo%5Ebar"
|
||||
);
|
||||
}
|
|
@ -2,4 +2,5 @@
|
|||
head =
|
||||
|
||||
[test_origin.js]
|
||||
[test_uri_escaping.js]
|
||||
[test_ipv6_host_literal.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче