зеркало из https://github.com/mozilla/gecko-dev.git
Bug 915824 - Move CSP tests from content/base/test into content/base/test/csp directory. r=geekboy
--HG-- rename : content/base/test/file_bug548193.sjs => content/base/test/csp/file_csp_report.sjs rename : content/base/test/file_bug717511.html => content/base/test/csp/file_multi_policy_injection_bypass.html rename : content/base/test/file_bug717511.html^headers^ => content/base/test/csp/file_multi_policy_injection_bypass.html^headers^ rename : content/base/test/file_bug717511_2.html => content/base/test/csp/file_multi_policy_injection_bypass_2.html rename : content/base/test/file_bug717511_2.html^headers^ => content/base/test/csp/file_multi_policy_injection_bypass_2.html^headers^ rename : content/base/test/file_bug558431.html => content/base/test/csp/file_policyuri_async_fetch.html rename : content/base/test/file_bug558431.html^headers^ => content/base/test/csp/file_policyuri_async_fetch.html^headers^ rename : content/base/test/file_bug650386_content.sjs => content/base/test/csp/file_redirect_content.sjs rename : content/base/test/file_bug650386_report.sjs => content/base/test/csp/file_redirect_report.sjs rename : content/base/test/file_bug702439.html => content/base/test/csp/file_subframe_run_js_if_allowed.html rename : content/base/test/test_bug702439.html^headers^ => content/base/test/csp/file_subframe_run_js_if_allowed.html^headers^ rename : content/base/test/test_bug650386_redirect_301.html => content/base/test/csp/test_301_redirect.html rename : content/base/test/test_bug650386_redirect_302.html => content/base/test/csp/test_302_redirect.html rename : content/base/test/test_bug650386_redirect_303.html => content/base/test/csp/test_303_redirect.html rename : content/base/test/test_bug650386_redirect_307.html => content/base/test/csp/test_307_redirect.html rename : content/base/test/test_bug548193.html => content/base/test/csp/test_csp_report.html rename : content/base/test/test_bug717511.html => content/base/test/csp/test_multi_policy_injection_bypass.html rename : content/base/test/test_bug558431.html => content/base/test/csp/test_policyuri_async_fetch.html rename : content/base/test/test_bug702439.html => content/base/test/csp/test_subframe_run_js_if_allowed.html
This commit is contained in:
Родитель
4dea2d8ecc
Коммит
a77e1c2641
|
@ -1,4 +1,5 @@
|
|||
// SJS file for CSP violation report test
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=548193
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var query = {};
|
|
@ -1,4 +1,7 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717511
|
||||
-->
|
||||
<body>
|
||||
<!-- these should be stopped by CSP after fixing bug 717511. :) -->
|
||||
<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png"> </img>
|
|
@ -1,4 +1,7 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717511
|
||||
-->
|
||||
<body>
|
||||
<!-- these should be stopped by CSP after fixing bug 717511. :) -->
|
||||
<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img2_bad&type=img/png"> </img>
|
|
@ -1,2 +1,5 @@
|
|||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=558431
|
||||
-->
|
||||
<iframe id="inner"
|
||||
src="/tests/content/base/test/file_CSP.sjs?content=%3Cdiv%20id%3D%22test%22%3Etest%20558431%3C/div%3E"></iframe>
|
|
@ -1,6 +1,7 @@
|
|||
// SJS file for tests for bug650386, serves file_bug650386_content.html
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=650386
|
||||
// This SJS file serves file_redirect_content.html
|
||||
// with a CSP that will trigger a violation and that will report it
|
||||
// to file_bug650386_report.sjs
|
||||
// to file_redirect_report.sjs
|
||||
//
|
||||
// This handles 301, 302, 303 and 307 redirects. The HTTP status code
|
||||
// returned/type of redirect to do comes from the query string
|
||||
|
@ -22,7 +23,7 @@ function handleRequest(request, response) {
|
|||
return;
|
||||
}
|
||||
|
||||
var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/content/base/test/file_bug650386_report.sjs?" + redirect;
|
||||
var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/content/base/test/csp/file_redirect_report.sjs?" + redirect;
|
||||
|
||||
response.setHeader("X-Content-Security-Policy", csp, false);
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// SJS file for tests for bug650386, this serves as CSP violation report target
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=650386
|
||||
// This SJS file serves as CSP violation report target
|
||||
// and issues a redirect, to make sure the browser does not post to the target
|
||||
// of the redirect, per CSP spec.
|
||||
// This handles 301, 302, 303 and 307 redirects. The HTTP status code
|
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=702439
|
||||
|
||||
This document is a child frame of a CSP document and the
|
||||
test verifies that it is permitted to run javascript: URLs
|
||||
if the parent has a policy that allows them.
|
||||
-->
|
||||
<body onload="document.getElementById('a').click()">
|
||||
<a id="a" href="javascript:parent.javascript_link_ran = true;
|
||||
parent.checkResult();">click</a>
|
||||
</body>
|
||||
</html>
|
|
@ -113,6 +113,17 @@ support-files =
|
|||
file_csp_regexp_parsing.js
|
||||
file_report_uri_missing_in_report_only_header.html
|
||||
file_report_uri_missing_in_report_only_header.html^headers^
|
||||
file_csp_report.sjs
|
||||
file_policyuri_async_fetch.html
|
||||
file_policyuri_async_fetch.html^headers^
|
||||
file_redirect_content.sjs
|
||||
file_redirect_report.sjs
|
||||
file_subframe_run_js_if_allowed.html
|
||||
file_subframe_run_js_if_allowed.html^headers^
|
||||
file_multi_policy_injection_bypass.html
|
||||
file_multi_policy_injection_bypass.html^headers^
|
||||
file_multi_policy_injection_bypass_2.html
|
||||
file_multi_policy_injection_bypass_2.html^headers^
|
||||
|
||||
[test_CSP.html]
|
||||
skip-if = toolkit == 'android' #TIMED_OUT
|
||||
|
@ -145,3 +156,11 @@ skip-if = toolkit == 'android' #TIMED_OUT
|
|||
[test_bug949549.html]
|
||||
[test_csp_regexp_parsing.html]
|
||||
[test_report_uri_missing_in_report_only_header.html]
|
||||
[test_csp_report.html]
|
||||
[test_policyuri_async_fetch.html]
|
||||
[test_301_redirect.html]
|
||||
[test_302_redirect.html]
|
||||
[test_303_redirect.html]
|
||||
[test_307_redirect.html]
|
||||
[test_subframe_run_js_if_allowed.html]
|
||||
[test_multi_policy_injection_bypass.html]
|
||||
|
|
|
@ -71,7 +71,7 @@ window.done = function(result) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// save this for last so that our listeners are registered.
|
||||
document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?301';
|
||||
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?301';
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
|
@ -71,7 +71,7 @@ window.done = function(result) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// save this for last so that our listeners are registered.
|
||||
document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?302';
|
||||
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?302';
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
|
@ -71,7 +71,7 @@ window.done = function(result) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// save this for last so that our listeners are registered.
|
||||
document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?303';
|
||||
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?303';
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
|
@ -71,7 +71,7 @@ window.done = function(result) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// save this for last so that our listeners are registered.
|
||||
document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?307';
|
||||
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?307';
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
|
@ -1,7 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=548193
|
||||
-->
|
||||
<head>
|
||||
<title>Test for CSP JSON violation report</title>
|
||||
<title>Test for Bug 548193</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
@ -73,13 +76,13 @@ examiner.prototype = {
|
|||
}
|
||||
|
||||
// content file that triggers a violation report
|
||||
var testFile = "file_bug548193.sjs";
|
||||
var testFile = "file_csp_report.sjs";
|
||||
|
||||
window.checkResults = function(reportObj) {
|
||||
var cspReport = reportObj["csp-report"];
|
||||
// correct violating request
|
||||
is(cspReport["document-uri"],
|
||||
"http://mochi.test:8888/tests/content/base/test/" + testFile,
|
||||
"http://mochi.test:8888/tests/content/base/test/csp/" + testFile,
|
||||
"Incorrect violating request");
|
||||
// correct blocked-uri
|
||||
is(cspReport["blocked-uri"],
|
|
@ -115,8 +115,8 @@ SimpleTest.waitForExplicitFinish();
|
|||
// save this for last so that our listeners are registered.
|
||||
// ... this loads the testbed of good and bad requests.
|
||||
|
||||
document.getElementById('cspframe').src = 'file_bug717511.html';
|
||||
document.getElementById('cspframe2').src = 'file_bug717511_2.html';
|
||||
document.getElementById('cspframe').src = 'file_multi_policy_injection_bypass.html';
|
||||
document.getElementById('cspframe2').src = 'file_multi_policy_injection_bypass_2.html';
|
||||
|
||||
</script>
|
||||
</pre>
|
|
@ -1,8 +1,11 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=558431
|
||||
-->
|
||||
<head>
|
||||
<title>Test for CSP async policy-uri</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<title>Test for Bug 558431</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -24,7 +27,7 @@ f.addEventListener('load', function() {
|
|||
SimpleTest.finish();
|
||||
}, false);
|
||||
// load the test frame
|
||||
f.src = "file_bug558431.html";
|
||||
f.src = "file_policyuri_async_fetch.html";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</body>
|
|
@ -8,7 +8,7 @@ permitted to execute javascript: URLs assuming the policy
|
|||
allows this.
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 428847</title>
|
||||
<title>Test for Bug 702439</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
@ -27,6 +27,6 @@ function checkResult()
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
<iframe id="i" src="file_bug702439.html"></iframe>
|
||||
<iframe id="i" src="file_subframe_run_js_if_allowed.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<html>
|
||||
<!--
|
||||
This document is a child frame of a CSP document and the
|
||||
test verifies that it is permitted to run javascript: URLs
|
||||
if the parent has a policy that allows them.
|
||||
-->
|
||||
<body onload="document.getElementById('a').click()">
|
||||
<a id="a" href="javascript:parent.javascript_link_ran = true;
|
||||
parent.checkResult();">click</a>
|
||||
</body>
|
||||
</html>
|
|
@ -94,10 +94,7 @@ support-files =
|
|||
file_bug503481b_inner.html
|
||||
file_bug541937.html
|
||||
file_bug541937.xhtml
|
||||
file_bug548193.sjs
|
||||
file_bug557892.html
|
||||
file_bug558431.html
|
||||
file_bug558431.html^headers^
|
||||
file_bug562137.txt
|
||||
file_bug590812-ref.xhtml
|
||||
file_bug590812.xml
|
||||
|
@ -112,8 +109,6 @@ support-files =
|
|||
file_bug604660-6.xsl
|
||||
file_bug622088.sjs
|
||||
file_bug622088_inner.html
|
||||
file_bug650386_content.sjs
|
||||
file_bug650386_report.sjs
|
||||
file_bug675121.sjs
|
||||
file_bug687859-16.js
|
||||
file_bug687859-16.js^headers^
|
||||
|
@ -124,16 +119,11 @@ support-files =
|
|||
file_bug687859-http.js^headers^
|
||||
file_bug687859-inherit.js
|
||||
file_bug692434.xml
|
||||
file_bug702439.html
|
||||
file_bug707142_baseline.json
|
||||
file_bug707142_bom.json
|
||||
file_bug707142_utf-16.json
|
||||
file_bug708620-2.html
|
||||
file_bug708620.html
|
||||
file_bug717511.html
|
||||
file_bug717511.html^headers^
|
||||
file_bug717511_2.html
|
||||
file_bug717511_2.html^headers^
|
||||
file_bug782342.txt
|
||||
file_bug787778.sjs
|
||||
file_bug804395.jar
|
||||
|
@ -422,11 +412,9 @@ skip-if = toolkit == 'android' #TIMED_OUT
|
|||
[test_bug544642.html]
|
||||
[test_bug545644.html]
|
||||
[test_bug545644.xhtml]
|
||||
[test_bug548193.html]
|
||||
[test_bug548463.html]
|
||||
[test_bug553896.xhtml]
|
||||
[test_bug557892.html]
|
||||
[test_bug558431.html]
|
||||
[test_bug558726.html]
|
||||
[test_bug559526.html]
|
||||
[test_bug560780.html]
|
||||
|
@ -465,10 +453,6 @@ skip-if = toolkit == 'android' #bug 687032
|
|||
[test_bug631615.html]
|
||||
[test_bug638112.html]
|
||||
[test_bug647518.html]
|
||||
[test_bug650386_redirect_301.html]
|
||||
[test_bug650386_redirect_302.html]
|
||||
[test_bug650386_redirect_303.html]
|
||||
[test_bug650386_redirect_307.html]
|
||||
[test_bug656283.html]
|
||||
[test_bug664916.html]
|
||||
[test_bug666604.html]
|
||||
|
@ -490,14 +474,11 @@ skip-if = toolkit == 'android' #bug 687032
|
|||
[test_bug696301-2.html]
|
||||
[test_bug698381.html]
|
||||
[test_bug698384.html]
|
||||
[test_bug702439.html]
|
||||
[test_bug702439.html^headers^]
|
||||
[test_bug704063.html]
|
||||
[test_bug707142.html]
|
||||
[test_bug708620.html]
|
||||
[test_bug711047.html]
|
||||
[test_bug711180.html]
|
||||
[test_bug717511.html]
|
||||
[test_bug719533.html]
|
||||
[test_bug726364.html]
|
||||
[test_bug737087.html]
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
"dom/events/test/test_bug667919-2.html":"bug 900969, 5 tests",
|
||||
|
||||
"content/html/content/test/test_bug561636.html":"observerservice not working",
|
||||
"content/base/test/test_bug548193.html":"observerservice issue",
|
||||
"content/base/test/csp/test_csp_report.html":"observerservice issue",
|
||||
"content/base/test/test_x-frame-options.html":"observerservice issue",
|
||||
|
||||
"content/base/test/test_XHRSendData.html":"seems to stall",
|
||||
|
@ -221,11 +221,11 @@
|
|||
"content/base/test/test_bug466409.html":"",
|
||||
"content/base/test/test_bug482935.html":"",
|
||||
"content/base/test/test_bug498433.html":"",
|
||||
"content/base/test/test_bug650386_redirect_301.html":"",
|
||||
"content/base/test/test_bug650386_redirect_302.html":"",
|
||||
"content/base/test/test_bug650386_redirect_303.html":"",
|
||||
"content/base/test/test_bug650386_redirect_307.html":"",
|
||||
"content/base/test/test_bug717511.html":"",
|
||||
"content/base/test/csp/test_301_redirect.html":"",
|
||||
"content/base/test/csp/test_302_redirect.html":"",
|
||||
"content/base/test/csp/test_303_redirect.html":"",
|
||||
"content/base/test/csp/test_307_redirect.html":"",
|
||||
"content/base/test/csp/test_multi_policy_injection_bypass.html":"",
|
||||
"content/base/test/test_copypaste.xhtml":"bug 904183",
|
||||
"content/base/test/test_copypaste.xul":"bug 904183",
|
||||
"content/base/test/csp/test_csp_redirects.html":"",
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
"dom/events/test/test_bug667919-2.html":"bug 900969, 5 tests",
|
||||
|
||||
"content/html/content/test/test_bug561636.html":"observerservice not working",
|
||||
"content/base/test/test_bug548193.html":"observerservice issue",
|
||||
"content/base/test/csp/test_csp_report.html":"observerservice issue",
|
||||
"content/base/test/test_x-frame-options.html":"observerservice issue",
|
||||
|
||||
"content/base/test/test_XHRSendData.html":"seems to stall",
|
||||
|
@ -224,11 +224,11 @@
|
|||
"content/base/test/test_bug466409.html":"",
|
||||
"content/base/test/test_bug482935.html":"",
|
||||
"content/base/test/test_bug498433.html":"",
|
||||
"content/base/test/test_bug650386_redirect_301.html":"",
|
||||
"content/base/test/test_bug650386_redirect_302.html":"",
|
||||
"content/base/test/test_bug650386_redirect_303.html":"",
|
||||
"content/base/test/test_bug650386_redirect_307.html":"",
|
||||
"content/base/test/test_bug717511.html":"",
|
||||
"content/base/test/csp/test_301_redirect.html":"",
|
||||
"content/base/test/csp/test_302_redirect.html":"",
|
||||
"content/base/test/csp/test_303_redirect.html":"",
|
||||
"content/base/test/csp/test_307_redirect.html":"",
|
||||
"content/base/test/csp/test_multi_policy_injection_bypass.html":"",
|
||||
"content/base/test/test_copypaste.xhtml":"bug 904183",
|
||||
"content/base/test/test_copypaste.xul":"bug 904183",
|
||||
"content/base/test/csp/test_csp_redirects.html":"",
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
"dom/events/test/test_bug864040.html":"failing when the test gets moved around, and on debug",
|
||||
|
||||
"content/html/content/test/test_bug561636.html":"observerservice not working",
|
||||
"content/base/test/test_bug548193.html":"observerservice issue",
|
||||
"content/base/test/csp/test_csp_report.html":"observerservice issue",
|
||||
"content/base/test/test_x-frame-options.html":"observerservice issue",
|
||||
|
||||
"content/base/test/test_XHRSendData.html":"seems to stall",
|
||||
|
@ -189,11 +189,11 @@
|
|||
"content/base/test/test_bug466409.html":"",
|
||||
"content/base/test/test_bug482935.html":"",
|
||||
"content/base/test/test_bug498433.html":"",
|
||||
"content/base/test/test_bug650386_redirect_301.html":"",
|
||||
"content/base/test/test_bug650386_redirect_302.html":"",
|
||||
"content/base/test/test_bug650386_redirect_303.html":"",
|
||||
"content/base/test/test_bug650386_redirect_307.html":"",
|
||||
"content/base/test/test_bug717511.html":"",
|
||||
"content/base/test/csp/test_301_redirect.html":"",
|
||||
"content/base/test/csp/test_302_redirect.html":"",
|
||||
"content/base/test/csp/test_303_redirect.html":"",
|
||||
"content/base/test/csp/test_307_redirect.html":"",
|
||||
"content/base/test/csp/test_multi_policy_injection_bypass.html":"",
|
||||
"content/base/test/test_copypaste.xhtml":"bug 904183",
|
||||
"content/base/test/test_copypaste.xul":"bug 904183",
|
||||
"content/base/test/test_fileapi_slice.html":"",
|
||||
|
|
Загрузка…
Ссылка в новой задаче