Bug 1147026 - CSP should ignore query string when checking a resource load - tests (r=dveditz)

This commit is contained in:
Christoph Kerschbaumer 2015-03-25 22:40:25 -07:00
Родитель 9543f7d3ac
Коммит 1362051ae4
3 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 1147026 - CSP should ignore query string when checking a resource load</title>
</head>
<body>
<div id="testdiv">blocked</div>
<script src="http://test1.example.com/tests/dom/base/test/csp/file_csp_path_matching.js?val=foo"></script>
</body>
</html>

Просмотреть файл

@ -86,6 +86,7 @@ support-files =
file_self_none_as_hostname_confusion.html
file_self_none_as_hostname_confusion.html^headers^
file_csp_path_matching.html
file_csp_path_matching_incl_query.html
file_csp_path_matching.js
file_csp_path_matching_redirect.html
file_csp_path_matching_redirect_server.sjs

Просмотреть файл

@ -79,9 +79,14 @@ function loadNextTest() {
}
else {
policy = policies[counter++];
var src = "file_csp_testserver.sjs";
var src = "file_csp_testserver.sjs?file=";
// append the file that should be served
src += "?file=" + escape("tests/dom/base/test/csp/file_csp_path_matching.html");
src += (counter % 2 == 0)
// load url including ref: example.com#foo
? escape("tests/dom/base/test/csp/file_csp_path_matching.html")
// load url including query: example.com?val=foo (bug 1147026)
: escape("tests/dom/base/test/csp/file_csp_path_matching_incl_query.html");
// append the CSP that should be used to serve the file
src += "&csp=" + escape("default-src 'none'; script-src " + policy[1]);