gecko-dev/dom/tests/mochitest/fetch/test_fetch_user_control_rp....

104 строки
4.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test fetch user control referrer policy Bug 1304623</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const SJS = "://example.com/tests/dom/base/test/referrer_testserver.sjs?";
const PARAMS = ["SCHEME_FROM", "SCHEME_TO", "CROSS_ORIGIN"];
const testCases = [
{ACTION: ["generate-fetch-user-control-policy-test"],
PREFS: [['network.http.referer.defaultPolicy', 0]],
TESTS: [
// 0. No referrer.
{NAME: 'default-policy-value-no-referrer-https-http',
DESC: 'default-policy-value-no-referrer-https-http',
SCHEME_FROM: 'https',
SCHEME_TO: 'http',
RESULT: 'none'},
{NAME: 'default-policy-value-no-referrer-https-https',
DESC: 'default-policy-value-no-referrer-https-https',
SCHEME_FROM: 'https',
SCHEME_TO: 'https',
RESULT: 'none'}],
},
{ACTION: ["generate-fetch-user-control-policy-test"],
PREFS: [['network.http.referer.defaultPolicy', 1]],
TESTS: [
// 1. Same origin.
{NAME: 'default-policy-value-same-origin-https-http',
DESC: 'default-policy-value-same-origin-https-http',
SCHEME_FROM: 'https',
SCHEME_TO: 'http',
RESULT: 'none'},
{NAME: 'default-policy-value-same-origin-http-https',
DESC: 'default-policy-value-same-origin-http-https',
SCHEME_FROM: 'http',
SCHEME_TO: 'https',
RESULT: 'none'},
{NAME: 'default-policy-value-same-origin-https-https',
DESC: 'default-policy-value-same-origin-https-https',
SCHEME_FROM: 'https',
SCHEME_TO: 'https',
RESULT: 'full'}],
},
{ACTION: ["generate-fetch-user-control-policy-test"],
PREFS: [['network.http.referer.defaultPolicy', 2]],
TESTS: [
// 2. strict-origin-when-cross-origin.
{NAME: 'default-policy-value-strict-origin-when-cross-origin-https-http',
DESC: 'default-policy-value-strict-origin-when-cross-origin-https-http',
SCHEME_FROM: 'https',
SCHEME_TO: 'http',
RESULT: 'none'},
{NAME: 'default-policy-value-strict-origin-when-cross-origin-http-https',
DESC: 'default-policy-value-strict-origin-when-cross-origin-http-https',
SCHEME_FROM: 'http',
SCHEME_TO: 'https',
RESULT: 'origin'},
{NAME: 'default-policy-value-strict-origin-when-cross-origin-https-https-same-origin',
DESC: 'default-policy-value-strict-origin-when-cross-origin-https-https-same-origin',
SCHEME_FROM: 'https',
SCHEME_TO: 'https',
RESULT: 'full'},
{NAME: 'default-policy-value-strict-origin-when-cross-origin-https-https-cross-origin',
DESC: 'default-policy-value-strict-origin-when-cross-origin-https-https-cross-origin',
SCHEME_FROM: 'https',
SCHEME_TO: 'https',
CROSS_ORIGIN: 'true',
RESULT: 'origin'}],
},
{ACTION: ["generate-fetch-user-control-policy-test"],
PREFS: [['network.http.referer.defaultPolicy', 3]],
TESTS: [
// 3. Default no-referrer-when-downgrade.
{NAME: 'default-policy-value-no-referrer-when-downgrade-https-http',
DESC: 'default-policy-value-no-referrer-when-downgrade-https-http',
SCHEME_FROM: 'https',
SCHEME_TO: 'http',
RESULT: 'none'},
{NAME: 'default-policy-value-no-referrer-when-downgrade-http-https',
DESC: 'default-policy-value-no-referrer-when-downgrade-http-https',
SCHEME_FROM: 'http',
SCHEME_TO: 'https',
RESULT: 'full'},
{NAME: 'default-policy-value-no-referrer-when-downgrade-https-https',
DESC: 'default-policy-value-no-referrer-when-downgrade-https-https',
SCHEME_FROM: 'https',
SCHEME_TO: 'https',
RESULT: 'full'}],
},
];
</script>
<script type="application/javascript" src="/tests/dom/base/test/referrer_helper.js"></script>
</head>
<body onload="tests.next();">
<iframe id="testframe"></iframe>
</body>
</html>