From 20549b7fe0111c8a3324ed115b8919b478af2f5a Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Wed, 23 Mar 2016 13:38:05 -0700 Subject: [PATCH] Bug 1251043 - Test form submission blocked by CSP. r=francois --- .../test/csp/file_form_action_server.sjs | 33 ++++++++ dom/security/test/csp/mochitest.ini | 2 + .../test/csp/test_form_action_blocks_url.html | 76 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 dom/security/test/csp/file_form_action_server.sjs create mode 100644 dom/security/test/csp/test_form_action_blocks_url.html diff --git a/dom/security/test/csp/file_form_action_server.sjs b/dom/security/test/csp/file_form_action_server.sjs new file mode 100644 index 000000000000..f2771d898c61 --- /dev/null +++ b/dom/security/test/csp/file_form_action_server.sjs @@ -0,0 +1,33 @@ +// Custom *.sjs file specifically for the needs of Bug 1251043 + +const FRAME = ` + + + + Bug 1251043 - Test form-action blocks URL + + + + CONTROL-TEXT +
+ +
+ + `; + +function handleRequest(request, response) +{ + // avoid confusing cache behaviors + response.setHeader("Cache-Control", "no-cache", false); + + // PART 1: Return a frame including the FORM and the CSP + if (request.queryString === "loadframe") { + response.write(FRAME); + return; + } + + // PART 2: We should never get here because the form + // should not be submitted. Just in case; return + // something unexpected so the test fails! + response.write("do'h"); +} diff --git a/dom/security/test/csp/mochitest.ini b/dom/security/test/csp/mochitest.ini index 7f37f19e9d00..dda8539e89dc 100644 --- a/dom/security/test/csp/mochitest.ini +++ b/dom/security/test/csp/mochitest.ini @@ -159,6 +159,7 @@ support-files = file_block_all_mcb.sjs file_block_all_mixed_content_frame_navigation1.html file_block_all_mixed_content_frame_navigation2.html + file_form_action_server.sjs [test_base-uri.html] [test_blob_data_schemes.html] @@ -243,3 +244,4 @@ skip-if = toolkit == 'android' #investigate in bug 1250814 tags = mcb [test_block_all_mixed_content_frame_navigation.html] tags = mcb +[test_form_action_blocks_url.html] diff --git a/dom/security/test/csp/test_form_action_blocks_url.html b/dom/security/test/csp/test_form_action_blocks_url.html new file mode 100644 index 000000000000..ef5c8d9b4f9f --- /dev/null +++ b/dom/security/test/csp/test_form_action_blocks_url.html @@ -0,0 +1,76 @@ + + + + Bug 1251043 - Test form-action blocks URL + + + + + + + + + +