B2G/gecko/content/base/test/file_bug548193.sjs
// SJS file for CSP violation report test
SJS file for CSP violation report test
SJS file for CSP violation report test
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);
  response.setHeader("Cache-Control", "no-cache", false);
  response.setHeader("X-Content-Security-Policy",
                     "allow 'self'; report-uri http://mochi.test:8888/csp-report.cgi",
                     false);
  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>');
}
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 ) ; response . setHeader ( "Cache-Control" , "no-cache" , false ) ; response . setHeader ( "X-Content-Security-Policy" , "allow 'self'; report-uri http://mochi.test:8888/csp-report.cgi" , false ) ; 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>' ) ; }
SJS file for CSP violation report test
SJS file for CSP violation report test
// avoid confusing cache behaviors // set CSP header // content which will trigger a violation report