From cff1769d3797bbd5143005be0b5ca1844007ec1f Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Wed, 13 Aug 2014 13:04:31 -0700 Subject: [PATCH] Bug 808292 - CSP: Implement path-level host-source matching, redirect tests (r=grobinson,sstamm) --- .../csp/file_csp_path_matching_redirect.html | 10 +++ ...file_csp_path_matching_redirect_server.sjs | 13 +++ content/base/test/csp/mochitest.ini | 3 + .../csp/test_csp_path_matching_redirect.html | 89 +++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 content/base/test/csp/file_csp_path_matching_redirect.html create mode 100644 content/base/test/csp/file_csp_path_matching_redirect_server.sjs create mode 100644 content/base/test/csp/test_csp_path_matching_redirect.html diff --git a/content/base/test/csp/file_csp_path_matching_redirect.html b/content/base/test/csp/file_csp_path_matching_redirect.html new file mode 100644 index 00000000000..5ef65cde7fc --- /dev/null +++ b/content/base/test/csp/file_csp_path_matching_redirect.html @@ -0,0 +1,10 @@ + + + + Bug 808292 - Implement path-level host-source matching to CSP + + +
blocked
+ + + diff --git a/content/base/test/csp/file_csp_path_matching_redirect_server.sjs b/content/base/test/csp/file_csp_path_matching_redirect_server.sjs new file mode 100644 index 00000000000..1b890fa6ff3 --- /dev/null +++ b/content/base/test/csp/file_csp_path_matching_redirect_server.sjs @@ -0,0 +1,13 @@ +// Redirect server specifically to handle redirects +// for path-level host-source matching +// see https://bugzilla.mozilla.org/show_bug.cgi?id=808292 + +function handleRequest(request, response) +{ + + var newLocation = "http://test1.example.com/tests/content/base/test/csp/file_csp_path_matching.js"; + + response.setStatusLine("1.1", 302, "Found"); + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Location", newLocation, false); +} diff --git a/content/base/test/csp/mochitest.ini b/content/base/test/csp/mochitest.ini index e9b0ffb1237..2304c909155 100644 --- a/content/base/test/csp/mochitest.ini +++ b/content/base/test/csp/mochitest.ini @@ -83,6 +83,8 @@ support-files = file_self_none_as_hostname_confusion.html^headers^ file_csp_path_matching.html file_csp_path_matching.js + file_csp_path_matching_redirect.html + file_csp_path_matching_redirect_server.sjs file_csp_testserver.sjs file_report_uri_missing_in_report_only_header.html file_report_uri_missing_in_report_only_header.html^headers^ @@ -122,6 +124,7 @@ skip-if = e10s || buildapp == 'b2g' # can't compute hashes in child process (bug [test_self_none_as_hostname_confusion.html] [test_bug949549.html] [test_csp_path_matching.html] +[test_csp_path_matching_redirect.html] [test_report_uri_missing_in_report_only_header.html] [test_csp_report.html] skip-if = e10s || buildapp == 'b2g' # http-on-opening-request observer not supported in child process (bug 1009632) diff --git a/content/base/test/csp/test_csp_path_matching_redirect.html b/content/base/test/csp/test_csp_path_matching_redirect.html new file mode 100644 index 00000000000..cf50a474156 --- /dev/null +++ b/content/base/test/csp/test_csp_path_matching_redirect.html @@ -0,0 +1,89 @@ + + + + Bug 808292 - Implement path-level host-source matching to CSP (redirects) + + + + + +

+ + + + +