зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1141959: Test nsIPrincipal.origin treats IPv6 host correctly.r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D66056 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
532519f8b2
Коммит
8e374dc349
|
@ -0,0 +1,39 @@
|
|||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var ssm = Services.scriptSecurityManager;
|
||||
function makeURI(uri) {
|
||||
return Services.io.newURI(uri);
|
||||
}
|
||||
|
||||
function testIPV6Host(aHost, aExpected) {
|
||||
var ipv6Host = ssm.createContentPrincipal(makeURI(aHost), {});
|
||||
Assert.equal(ipv6Host.origin, aExpected);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
testIPV6Host("http://[::1]/", "http://[::1]");
|
||||
|
||||
testIPV6Host(
|
||||
"http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]/",
|
||||
"http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]"
|
||||
);
|
||||
|
||||
testIPV6Host(
|
||||
"http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443/",
|
||||
"http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"
|
||||
);
|
||||
|
||||
testIPV6Host(
|
||||
"http://[2001:db8:85a3::1319:8a2e:370:7348]/",
|
||||
"http://[2001:db8:85a3:0:1319:8a2e:370:7348]"
|
||||
);
|
||||
|
||||
testIPV6Host(
|
||||
"http://[20D1:0000:3238:DFE1:63:0000:0000:FEFB]/",
|
||||
"http://[20d1:0:3238:dfe1:63::fefb]"
|
||||
);
|
||||
|
||||
testIPV6Host(
|
||||
"http://[20D1:0:3238:DFE1:63::FEFB]/",
|
||||
"http://[20d1:0:3238:dfe1:63::fefb]"
|
||||
);
|
||||
}
|
|
@ -2,3 +2,4 @@
|
|||
head =
|
||||
|
||||
[test_origin.js]
|
||||
[test_ipv6_host_literal.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче