Bug 1084652 - CSP: Violated directive must not be empty when sending csp reports - test updates (r=sstamm)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Wed, 29 Oct 2014 14:47:26 -0700
changeset 213237 228f249d29315a23eb795b608f199639ebde0d95
parent 213236 97a2c1e265cf21cb1d25f3795904785c851caaf2
child 213238 acd029ee3d13abf6106c559b8c8909139891e9cf
push id27745
push usercbook@mozilla.com
push dateFri, 31 Oct 2014 13:09:12 +0000
treeherdermozilla-central@6bd2071b373f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstamm
bugs1084652
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1084652 - CSP: Violated directive must not be empty when sending csp reports - test updates (r=sstamm)
dom/base/test/csp/test_csp_report.html
--- a/dom/base/test/csp/test_csp_report.html
+++ b/dom/base/test/csp/test_csp_report.html
@@ -14,30 +14,30 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 
 <iframe style="width:200px;height:200px;" id='cspframe'></iframe>
 <script class="testbody" type="text/javascript">
 
 /*
  * Description of the test:
  * We try to load an inline-src using a policy that constrains
- * all scripts from running (script-src 'none'). We verify that
+ * all scripts from running (default-src 'none'). We verify that
  * the generated csp-report contains the expceted values. If any
  * of the JSON is not formatted properly (e.g. not properly escaped)
  * then JSON.parse will fail, which allows to pinpoint such errors
  * in the catch block, and the test will fail. Since we use an
  * observer, we can set the actual report-uri to a foo value.
  */
 
 const testfile = "tests/dom/base/test/csp/file_csp_report.html";
 const reportURI = "http://mochi.test:8888/foo.sjs";
-const policy = "script-src 'none'; report-uri " + reportURI;
+const policy = "default-src 'none'; report-uri " + reportURI;
 const docUri = "http://mochi.test:8888/tests/dom/base/test/csp/file_csp_testserver.sjs" +
                "?file=tests/dom/base/test/csp/file_csp_report.html" +
-               "&csp=script-src%20%27none%27%3B%20report-uri%20http%3A//mochi.test%3A8888/foo.sjs";
+               "&csp=default-src%20%27none%27%3B%20report-uri%20http%3A//mochi.test%3A8888/foo.sjs";
 
 window.checkResults = function(reportObj) {
   var cspReport = reportObj["csp-report"];
 
   // The following uris' fragments should be stripped before reporting:
   //    * document-uri
   //    * blocked-uri
   //    * source-file
@@ -45,19 +45,19 @@ window.checkResults = function(reportObj
   is(cspReport["document-uri"], docUri, "Incorrect document-uri");
 
   // we can not test for the whole referrer since it includes platform specific information
   ok(cspReport["referrer"].startsWith("http://mochi.test:8888/tests/dom/base/test/csp/test_csp_report.html"),
      "Incorrect referrer");
 
   is(cspReport["blocked-uri"], "self", "Incorrect blocked-uri");
 
-  is(cspReport["violated-directive"], "script-src 'none'", "Incorrect violated-directive");
+  is(cspReport["violated-directive"], "default-src 'none'", "Incorrect violated-directive");
 
-  is(cspReport["original-policy"], "script-src 'none'; report-uri http://mochi.test:8888/foo.sjs",
+  is(cspReport["original-policy"], "default-src 'none'; report-uri http://mochi.test:8888/foo.sjs",
      "Incorrect original-policy");
 
   is(cspReport["source-file"], docUri, "Incorrect source-file");
 
   is(cspReport["script-sample"], "\n    var foo = \"propEscFoo\";\n    var bar...",
      "Incorrect script-sample");
 
   is(cspReport["line-number"], "7", "Incorrect line-number");