Bug 1418243 - Fix mochitest failures due to violationDirective change. r=ckerschb
authorChung-Sheng Fu <cfu@mozilla.com>
Tue, 16 Jan 2018 23:00:00 +0200
changeset 453956 a1752a8ab7a040da7807d33d5bda0c07721a33d2
parent 453955 6b40a9ee5e9ba361bdd249b1e81b00ab329fdb08
child 453957 e5496e22cd86612e7d3099b33a97793957b3d815
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1418243
milestone59.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 1418243 - Fix mochitest failures due to violationDirective change. r=ckerschb MozReview-Commit-ID: AphtAxYo6Hr
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js
devtools/client/webconsole/test/browser_webconsole_bug_1010953_cspro.js
devtools/client/webconsole/test/browser_webconsole_bug_1247459_violation.js
devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
dom/security/test/csp/test_frame_ancestors_ro.html
dom/security/test/csp/test_report.html
dom/security/test/csp/test_report_for_import.html
dom/security/test/csp/test_security_policy_violation_event.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js
@@ -16,21 +16,21 @@ See Bug 1010953.
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only test";
 const TEST_VIOLATION = "http://example.com/browser/devtools/client/webconsole/" +
                        "new-console-output/test/mochitest/test-cspro.html";
 const CSP_VIOLATION_MSG =
   "Content Security Policy: The page\u2019s settings blocked the loading of a resource " +
-  "at http://some.example.com/cspro.png (\u201cimg-src http://example.com\u201d).";
+  "at http://some.example.com/cspro.png (\u201cimg-src\u201d).";
 const CSP_REPORT_MSG =
   "Content Security Policy: The page\u2019s settings observed the loading of a " +
   "resource at http://some.example.com/cspro.js " +
-  "(\u201cscript-src http://example.com\u201d). A CSP report is being sent.";
+  "(\u201cscript-src\u201d). A CSP report is being sent.";
 
 add_task(async function () {
   let hud = await openNewTabAndConsole(TEST_URI);
 
   let onCspViolationMessage = waitForMessage(hud, CSP_VIOLATION_MSG, ".message.error");
   let onCspReportMessage = waitForMessage(hud, CSP_REPORT_MSG, ".message.error");
 
   info("Load a page with CSP warnings.");
--- a/devtools/client/webconsole/test/browser_webconsole_bug_1010953_cspro.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_1010953_cspro.js
@@ -18,21 +18,21 @@ CSP_REPORT_MSG are confirmed to be found
 
 const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only " +
                  "test (bug 1010953)";
 const TEST_VIOLATION = "http://example.com/browser/devtools/client/" +
                        "webconsole/test/test_bug_1010953_cspro.html";
 const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
                           "blocked the loading of a resource at " +
                           "http://some.example.com/test.png " +
-                          "(\u201cimg-src http://example.com\u201d).";
+                          "(\u201cimg-src\u201d).";
 const CSP_REPORT_MSG = "Content Security Policy: The page\u2019s settings " +
                        "observed the loading of a resource at " +
                        "http://some.example.com/test_bug_1010953_cspro.js " +
-                       "(\u201cscript-src http://example.com\u201d). A CSP report is " +
+                       "(\u201cscript-src\u201d). A CSP report is " +
                        "being sent.";
 
 add_task(function* () {
   let { browser } = yield loadTab(TEST_URI);
 
   let hud = yield openConsole();
 
   hud.jsterm.clearOutput();
--- a/devtools/client/webconsole/test/browser_webconsole_bug_1247459_violation.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_1247459_violation.js
@@ -8,18 +8,17 @@
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,Web Console CSP violation test";
 const TEST_VIOLATION = "https://example.com/browser/devtools/client/" +
                        "webconsole/test/test_bug_1247459_violation.html";
 const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
                           "blocked the loading of a resource at " +
-                          "http://some.example.com/test.png (\u201cimg-src " +
-                          "https://example.com\u201d).";
+                          "http://some.example.com/test.png (\u201cimg-src\u201d).";
 
 add_task(function* () {
   let { browser } = yield loadTab(TEST_URI);
 
   let hud = yield openConsole();
 
   hud.jsterm.clearOutput();
 
--- a/devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
@@ -7,18 +7,17 @@
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,Web Console CSP violation test";
 const TEST_VIOLATION = "https://example.com/browser/devtools/client/" +
                        "webconsole/test/test_bug_770099_violation.html";
 const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
                           "blocked the loading of a resource at " +
-                          "http://some.example.com/test.png (\u201cdefault-src " +
-                          "https://example.com\u201d).";
+                          "http://some.example.com/test.png (\u201cdefault-src\u201d).";
 
 add_task(function* () {
   let { browser } = yield loadTab(TEST_URI);
 
   let hud = yield openConsole();
 
   hud.jsterm.clearOutput();
 
--- a/dom/security/test/csp/test_frame_ancestors_ro.html
+++ b/dom/security/test/csp/test_frame_ancestors_ro.html
@@ -18,17 +18,17 @@ let testResults = {
 
 function checkResults(reportObj) {
   let cspReport = reportObj["csp-report"];
   is(cspReport["document-uri"], docUri, "Incorrect document-uri");
 
   // we can not test for the whole referrer since it includes platform specific information
   is(cspReport["referrer"], document.location.toString(), "Incorrect referrer");
   is(cspReport["blocked-uri"], document.location.toString(), "Incorrect blocked-uri");
-  is(cspReport["violated-directive"], "frame-ancestors 'none'", "Incorrect violated-directive");
+  is(cspReport["violated-directive"], "frame-ancestors", "Incorrect violated-directive");
   is(cspReport["original-policy"], "frame-ancestors 'none'; report-uri http://mochi.test:8888/foo.sjs", "Incorrect original-policy");
   testResults.reportFired = true;
 }
 
 let chromeScriptUrl = SimpleTest.getTestFileURL("file_report_chromescript.js");
 let script = SpecialPowers.loadChromeScript(chromeScriptUrl);
 
 script.addMessageListener('opening-request-completed', function ml(msg) {
--- a/dom/security/test/csp/test_report.html
+++ b/dom/security/test/csp/test_report.html
@@ -45,17 +45,17 @@ 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/security/test/csp/test_report.html"),
      "Incorrect referrer");
 
   is(cspReport["blocked-uri"], "self", "Incorrect blocked-uri");
 
-  is(cspReport["violated-directive"], "default-src 'none'", "Incorrect violated-directive");
+  is(cspReport["violated-directive"], "default-src", "Incorrect violated-directive");
 
   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");
--- a/dom/security/test/csp/test_report_for_import.html
+++ b/dom/security/test/csp/test_report_for_import.html
@@ -45,17 +45,17 @@ function checkResults(reportStr) {
     var reportObj = JSON.parse(reportStr);
     var cspReport = reportObj["csp-report"];
 
     is(cspReport["document-uri"], DOC_URI, "Incorrect document-uri");
     is(cspReport["referrer"],
        "http://mochi.test:8888/tests/dom/security/test/csp/test_report_for_import.html",
        "Incorrect referrer");
     is(cspReport["violated-directive"],
-       "style-src http://mochi.test:8888",
+       "style-src",
        "Incorrect violated-directive");
     is(cspReport["original-policy"],
        "style-src http://mochi.test:8888; report-uri " +
        "http://mochi.test:8888/tests/dom/security/test/csp/file_report_for_import_server.sjs?report",
        "Incorrect original-policy");
     is(cspReport["blocked-uri"],
        "http://example.com",
        "Incorrect blocked-uri");
--- a/dom/security/test/csp/test_security_policy_violation_event.html
+++ b/dom/security/test/csp/test_security_policy_violation_event.html
@@ -6,14 +6,14 @@
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({
   set: [
     ["security.csp.enable_violation_events", true]
   ]
 });
 document.addEventListener("securitypolicyviolation", (e) => {
   SimpleTest.is(e.blockedURI, "http://mochi.test:8888/foo/bar.jpg", "blockedURI");
-  SimpleTest.todo_is(e.violatedDirective, "img-src", "violatedDirective")
+  SimpleTest.is(e.violatedDirective, "img-src", "violatedDirective")
   SimpleTest.is(e.originalPolicy, "img-src 'none'", "originalPolicy");
   SimpleTest.finish();
 });
 </script>
 <img src="http://mochi.test:8888/foo/bar.jpg">