mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
60 lines
2.1 KiB
HTML
60 lines
2.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=918397
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 918397</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=918397">Mozilla Bug 918397</a>
|
|
<p id="display"></p>
|
|
|
|
<iframe id="cspframe"></iframe>
|
|
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
// Load locale strings during mochitest
|
|
var stringBundleService = SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
|
|
.getService(SpecialPowers.Ci.nsIStringBundleService);
|
|
var localizer = stringBundleService.createBundle("chrome://global/locale/security/security.properties");
|
|
var depreHeadersMsg = localizer.GetStringFromName("OldCSPHeaderDeprecated", 0)
|
|
var dualHeadersMsg = localizer.GetStringFromName("BothCSPHeadersPresent", 0)
|
|
|
|
function cleanup() {
|
|
SpecialPowers.postConsoleSentinel();
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
// listen on the console before loading the iframe
|
|
SpecialPowers.registerConsoleListener(function ConsoleMsgListener(aMsg) {
|
|
// Note: We do not want to see the deprecation warning appear in the console.
|
|
// This test can only be sure that the deprecation warning does not appear
|
|
// iff the deprecation warning appears before the dual header warning appears
|
|
// in the console.
|
|
if (aMsg.message.indexOf(depreHeadersMsg) > -1) {
|
|
ok(false, "Deprecated CSP header warning should not be present.");
|
|
return;
|
|
} else if (aMsg.message.indexOf(dualHeadersMsg) > -1) {
|
|
ok(true, "Dual CSP header warning present.");
|
|
SimpleTest.executeSoon(cleanup);
|
|
} else {
|
|
// if some other console message is present, we wait
|
|
return;
|
|
}
|
|
});
|
|
|
|
// get ready and test
|
|
SimpleTest.waitForExplicitFinish();
|
|
SpecialPowers.pushPrefEnv(
|
|
{'set': [["security.csp.speccompliant", true]]},
|
|
function() {
|
|
document.getElementById('cspframe').src = 'file_dual_headers_warning.html';
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|