gecko-dev/content/base/test/csp/file_csp_report.sjs

26 lines
892 B
Plaintext
Raw Normal View History

2010-05-27 16:12:32 +00:00
// SJS file for CSP violation report test
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
2014-02-18 14:47:53 +00:00
// https://bugzilla.mozilla.org/show_bug.cgi?id=548193
2010-05-27 16:12:32 +00:00
function handleRequest(request, response)
{
var query = {};
request.queryString.split('&').forEach(function (val) {
var [name, value] = val.split('=');
query[name] = unescape(value);
});
response.setHeader("Content-Type", "text/html", false);
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
// set CSP header
response.setHeader("Content-Security-Policy",
"default-src 'self'; report-uri http://mochi.test:8888/csp-report.cgi",
2010-05-27 16:12:32 +00:00
false);
// content which will trigger a violation report
response.write('<html><body>');
response.write('<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png"> </img>');
response.write('</body></html>');
}