Bug 1418243 - Fix mochitest failures due to violationDirective change. r=ckerschb

MozReview-Commit-ID: AphtAxYo6Hr

--HG--
extra : rebase_source : 24cd7773cb1f3583c524d142908f859ff5e88e8a
This commit is contained in:
Chung-Sheng Fu 2018-01-16 23:00:00 +02:00
Родитель bc05f945c6
Коммит 0319902c5b
8 изменённых файлов: 10 добавлений и 12 удалений

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

@ -21,11 +21,11 @@ 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);

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

@ -23,11 +23,11 @@ const TEST_VIOLATION = "http://example.com/browser/devtools/client/" +
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* () {

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

@ -13,8 +13,7 @@ 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);

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

@ -12,8 +12,7 @@ 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);

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

@ -23,7 +23,7 @@ function checkResults(reportObj) {
// 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;
}

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

@ -50,7 +50,7 @@ window.checkResults = function(reportObj) {
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");

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

@ -50,7 +50,7 @@ function checkResults(reportStr) {
"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 " +

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

@ -11,7 +11,7 @@ SpecialPowers.pushPrefEnv({
});
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();
});