Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: docshell/test/mochitest/mochitest.toml
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="text/javascript">
var channel = SpecialPowers.wrap(window).docShell.currentDocumentChannel;
var loadInfo = channel.loadInfo;
// 1) perform some sanity checks
var triggeringPrincipal = channel.loadInfo.triggeringPrincipal.asciiSpec;
var loadingPrincipal = channel.loadInfo.loadingPrincipal.asciiSpec;
var principalToInherit = channel.loadInfo.principalToInherit.asciiSpec;
"initial triggeringPrincipal correct");
"initial loadingPrincipal correct");
"initial principalToInherit correct");
// reset principals on the loadinfo
loadInfo.resetPrincipalToInheritToNullPrincipal();
// 2) verify loadInfo contains the correct principals
triggeringPrincipal = channel.loadInfo.triggeringPrincipal.asciiSpec;
loadingPrincipal = channel.loadInfo.loadingPrincipal.asciiSpec;
principalToInherit = channel.loadInfo.principalToInherit;
"triggeringPrincipal after resetting correct");
"loadingPrincipal after resetting correct");
ok(principalToInherit.isNullPrincipal
"principalToInherit after resetting correct");
// 3) verify that getChannelResultPrincipal returns right principal
var resultPrincipal = SpecialPowers.Services.scriptSecurityManager
.getChannelResultPrincipal(channel);
ok(resultPrincipal.isNullPrincipal,
"resultPrincipal after resetting correct");
</script>
</pre>
</body>
</html>