Bug 991466 - Remove pushprevenv for security.csp.speccompliant from tests since the pref no longer has effect. (r=ckerschb)

--HG--
extra : rebase_source : 61a52591fc5616486900367e7c06729cce889f13
This commit is contained in:
Sid Stamm 2014-07-07 11:59:59 -07:00
parent 7eef9caec0
commit 6de3623e9b
31 changed files with 122 additions and 246 deletions

View File

@ -66,13 +66,8 @@ window.done = function(result) {
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?301';
});
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?301';
</script>
</pre>
</body>

View File

@ -66,13 +66,8 @@ window.done = function(result) {
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?302';
});
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?302';
</script>
</pre>
</body>

View File

@ -66,13 +66,8 @@ window.done = function(result) {
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?303';
});
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?303';
</script>
</pre>
</body>

View File

@ -66,13 +66,9 @@ window.done = function(result) {
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?307';
});
// ... this loads the testbed of good and bad requests.
document.getElementById('content_iframe').src = 'file_redirect_content.sjs?307';
</script>
</pre>
</body>

View File

@ -101,8 +101,7 @@ window.testResult = function(testname, result, msg) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true],
// This defaults to 0 ("preload none") on mobile (B2G/Android), which
{'set':[// This defaults to 0 ("preload none") on mobile (B2G/Android), which
// blocks loading the resource until the user interacts with a
// corresponding widget, which breaks the media_* tests. We set it
// back to the default used by desktop Firefox to get consistent

View File

@ -65,16 +65,11 @@ function checkBlocked () {
checkExplicitFinish();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
document.getElementById('xsltframe').addEventListener('load', checkAllowed, false);
document.getElementById('xsltframe').src = 'file_CSP_bug663567_allows.xml';
document.getElementById('xsltframe').addEventListener('load', checkAllowed, false);
document.getElementById('xsltframe').src = 'file_CSP_bug663567_allows.xml';
document.getElementById('xsltframe2').addEventListener('load', checkBlocked, false);
document.getElementById('xsltframe2').src = 'file_CSP_bug663567_blocks.xml';
}
);
document.getElementById('xsltframe2').addEventListener('load', checkBlocked, false);
document.getElementById('xsltframe2').src = 'file_CSP_bug663567_blocks.xml';
</script>
</body>

View File

@ -25,33 +25,28 @@ var checkExplicitFinish = function () {
}
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
// add event listeners for CSP-permitted EventSrc callbacks
addEventListener('allowedEventSrcCallbackOK', function (e) {
ok(true, "OK: CSP allows EventSource for whitelisted domain!");
checkExplicitFinish();
}, false);
addEventListener('allowedEventSrcCallbackFailed', function (e) {
ok(false, "Error: CSP blocks EventSource for whitelisted domain!");
checkExplicitFinish();
}, false);
// add event listeners for CSP-permitted EventSrc callbacks
addEventListener('allowedEventSrcCallbackOK', function (e) {
ok(true, "OK: CSP allows EventSource for whitelisted domain!");
checkExplicitFinish();
}, false);
addEventListener('allowedEventSrcCallbackFailed', function (e) {
ok(false, "Error: CSP blocks EventSource for whitelisted domain!");
checkExplicitFinish();
}, false);
// add event listeners for CSP-blocked EventSrc callbacks
addEventListener('blockedEventSrcCallbackOK', function (e) {
ok(false, "Error: CSP allows EventSource to not whitelisted domain!");
checkExplicitFinish();
}, false);
addEventListener('blockedEventSrcCallbackFailed', function (e) {
ok(true, "OK: CSP blocks EventSource for not whitelisted domain!");
checkExplicitFinish();
}, false);
// add event listeners for CSP-blocked EventSrc callbacks
addEventListener('blockedEventSrcCallbackOK', function (e) {
ok(false, "Error: CSP allows EventSource to not whitelisted domain!");
checkExplicitFinish();
}, false);
addEventListener('blockedEventSrcCallbackFailed', function (e) {
ok(true, "OK: CSP blocks EventSource for not whitelisted domain!");
checkExplicitFinish();
}, false);
// load it
document.getElementById('eventframe').src = 'file_CSP_bug802872.html';
}
);
// load it
document.getElementById('eventframe').src = 'file_CSP_bug802872.html';
</script>
</body>

View File

@ -50,15 +50,10 @@ function checkBlocked () {
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
document.getElementById('cspframe').src = 'file_CSP_bug885433_allows.html';
document.getElementById('cspframe').addEventListener('load', checkAllowed, false);
document.getElementById('cspframe2').src = 'file_CSP_bug885433_blocks.html';
document.getElementById('cspframe2').addEventListener('load', checkBlocked, false);
}
);
document.getElementById('cspframe').src = 'file_CSP_bug885433_allows.html';
document.getElementById('cspframe').addEventListener('load', checkAllowed, false);
document.getElementById('cspframe2').src = 'file_CSP_bug885433_blocks.html';
document.getElementById('cspframe2').addEventListener('load', checkBlocked, false);
</script>
</pre>
</body>

View File

@ -56,22 +56,17 @@ function checkDefaultSrcWithStyleSrc() {
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
document.getElementById('testframe1').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'");
document.getElementById('testframe1').addEventListener('load', checkDefaultSrcOnly, false);
document.getElementById('testframe1').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'");
document.getElementById('testframe1').addEventListener('load', checkDefaultSrcOnly, false);
document.getElementById('testframe2').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'self'");
document.getElementById('testframe2').addEventListener('load', checkDefaultSrcWithScriptSrc, false);
document.getElementById('testframe2').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'self'");
document.getElementById('testframe2').addEventListener('load', checkDefaultSrcWithScriptSrc, false);
document.getElementById('testframe3').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self'");
document.getElementById('testframe3').addEventListener('load', checkDefaultSrcWithStyleSrc, false);
}
);
document.getElementById('testframe3').src = 'file_CSP_bug888172.sjs?csp=' +
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self'");
document.getElementById('testframe3').addEventListener('load', checkDefaultSrcWithStyleSrc, false);
</script>
</pre>
</body>

View File

@ -120,15 +120,10 @@ function checkInlineWithNone() {
"Inline scripts should be blocked (style-src 'unsafe-inline' with none)");
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
document.getElementById('testframe1').src = 'file_CSP_bug909029_star.html';
document.getElementById('testframe1').addEventListener('load', checkInlineWithStar, false);
document.getElementById('testframe2').src = 'file_CSP_bug909029_none.html';
document.getElementById('testframe2').addEventListener('load', checkInlineWithNone, false);
}
);
document.getElementById('testframe1').src = 'file_CSP_bug909029_star.html';
document.getElementById('testframe1').addEventListener('load', checkInlineWithStar, false);
document.getElementById('testframe2').src = 'file_CSP_bug909029_none.html';
document.getElementById('testframe2').addEventListener('load', checkInlineWithNone, false);
</script>
</body>
</html>

View File

@ -58,13 +58,8 @@ function checkBlocked () {
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
document.getElementById('xsltframe').addEventListener('load', checkAllowed, false);
document.getElementById('xsltframe').src = 'file_CSP_bug910139.sjs';
}
);
document.getElementById('xsltframe').addEventListener('load', checkAllowed, false);
document.getElementById('xsltframe').src = 'file_CSP_bug910139.sjs';
</script>
</body>

View File

@ -97,13 +97,9 @@ window.testResult = function(testname, result, msg) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_bug941404.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_bug941404.html';
</script>
</pre>

View File

@ -49,14 +49,10 @@ var checkTestResults = function() {
// set up and go
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_evalscript_main.html';
document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_evalscript_main.html';
document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed.html';
</script>
</pre>
</body>

View File

@ -48,15 +48,11 @@ var checkTestResults = function() {
// set up and go
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_evalscript_main_getCRMFRequest.html';
document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed_getCRMFRequest.html';
document.getElementById('cspframe3').src = 'file_CSP_evalscript_no_CSP_at_all.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_evalscript_main_getCRMFRequest.html';
document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed_getCRMFRequest.html';
document.getElementById('cspframe3').src = 'file_CSP_evalscript_no_CSP_at_all.html';
</script>
</pre>
</body>

View File

@ -147,14 +147,9 @@ function receiveMessage(event) {
window.examiner = new examiner();
SimpleTest.waitForExplicitFinish();
// added this so the tests run even if we don't flip the pref on by default.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_frameancestors_main.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_frameancestors_main.html';
</script>
</pre>

View File

@ -101,16 +101,12 @@ function clickit2() {
sendMouseEvent({type:'click'}, a, cspframe2.contentWindow);
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe1').src = 'file_CSP_inlinescript_main.html';
document.getElementById('cspframe1').addEventListener('load', clickit1, false);
document.getElementById('cspframe2').src = 'file_CSP_inlinescript_main_allowed.html';
document.getElementById('cspframe2').addEventListener('load', clickit2, false);
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe1').src = 'file_CSP_inlinescript_main.html';
document.getElementById('cspframe1').addEventListener('load', clickit1, false);
document.getElementById('cspframe2').src = 'file_CSP_inlinescript_main_allowed.html';
document.getElementById('cspframe2').addEventListener('load', clickit2, false);
</script>
</pre>
</body>

View File

@ -94,17 +94,13 @@ function checkIfDone() {
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe1').src = 'file_CSP_inlinestyle_main.html';
document.getElementById('cspframe1').addEventListener('load', checkStyles, false);
document.getElementById('cspframe2').src = 'file_CSP_inlinestyle_main_allowed.html';
document.getElementById('cspframe2').addEventListener('load', checkStylesAllowed, false);
}
);
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe1').src = 'file_CSP_inlinestyle_main.html';
document.getElementById('cspframe1').addEventListener('load', checkStyles, false);
document.getElementById('cspframe2').src = 'file_CSP_inlinestyle_main_allowed.html';
document.getElementById('cspframe2').addEventListener('load', checkStylesAllowed, false);
</script>
</pre>
</body>

View File

@ -235,13 +235,9 @@ window.testResult = function(testname, result, msg) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'http://mochi.test:8888' + path + 'file_bug836922_npolicies.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'http://mochi.test:8888' + path + 'file_bug836922_npolicies.html';
</script>
</pre>

View File

@ -157,18 +157,14 @@ window.testResult = function(testname, result, msg) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_bug886164.html';
document.getElementById('cspframe2').src = 'file_bug886164_2.html';
document.getElementById('cspframe3').src = 'file_bug886164_3.html';
document.getElementById('cspframe4').src = 'file_bug886164_4.html';
document.getElementById('cspframe5').src = 'file_bug886164_5.html';
document.getElementById('cspframe6').src = 'file_bug886164_6.html';
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_bug886164.html';
document.getElementById('cspframe2').src = 'file_bug886164_2.html';
document.getElementById('cspframe3').src = 'file_bug886164_3.html';
document.getElementById('cspframe4').src = 'file_bug886164_4.html';
document.getElementById('cspframe5').src = 'file_bug886164_5.html';
document.getElementById('cspframe6').src = 'file_bug886164_6.html';
</script>
</pre>

View File

@ -213,8 +213,7 @@ SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
["security.apps.privileged.CSP.default", DEFAULT_CSP_PRIV],
["security.apps.certified.CSP.default", DEFAULT_CSP_CERT],
["security.mixed_content.block_active_content", false],
["security.mixed_content.block_display_content", false],
["security.csp.speccompliant", true]]},
["security.mixed_content.block_display_content", false]]},
function() { gTestRunner.next(); });

View File

@ -218,8 +218,7 @@ SpecialPowers.addPermission("browser", true, "https://example.com");
SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
["security.apps.privileged.CSP.default", DEFAULT_CSP_PRIV],
["security.apps.certified.CSP.default", DEFAULT_CSP_CERT],
["security.csp.speccompliant", true]]},
["security.apps.certified.CSP.default", DEFAULT_CSP_CERT]]},
function() { gTestRunner.next(); });

View File

@ -111,8 +111,7 @@ var testResult = function(testName, url, result) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true],
// This defaults to 0 ("preload none") on mobile (B2G/Android), which
{'set':[// This defaults to 0 ("preload none") on mobile (B2G/Android), which
// blocks loading the resource until the user interacts with a
// corresponding widget, which breaks the media_* tests. We set it
// back to the default used by desktop Firefox to get consistent

View File

@ -94,12 +94,7 @@ function test() {
loadNextTest();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
loadNextTest();
}
);
loadNextTest();
</script>
</body>

View File

@ -100,13 +100,9 @@ window.examiner = new examiner();
SimpleTest.waitForExplicitFinish();
// load the resource which will generate a CSP violation report
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById("cspframe").src = testFile;
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById("cspframe").src = testFile;
</script>
</pre>
</body>

View File

@ -125,14 +125,10 @@ function checkInline () {
// set up and go
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_hash_source.html';
document.getElementById('cspframe').addEventListener('load', checkInline, false);
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_hash_source.html';
document.getElementById('cspframe').addEventListener('load', checkInline, false);
</script>
</pre>
</body>

View File

@ -110,13 +110,9 @@ window.testResult = function(testname, result, msg) {
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_multi_policy_injection_bypass.html';
document.getElementById('cspframe2').src = 'file_multi_policy_injection_bypass_2.html';
});
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_multi_policy_injection_bypass.html';
document.getElementById('cspframe2').src = 'file_multi_policy_injection_bypass_2.html';
</script>
</pre>
</body>

View File

@ -112,14 +112,10 @@ function checkInlineScriptsAndStyles () {
window.examiner = new examiner();
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_nonce_source.html';
document.getElementById('cspframe').addEventListener('load', checkInlineScriptsAndStyles, false);
});
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_nonce_source.html';
document.getElementById('cspframe').addEventListener('load', checkInlineScriptsAndStyles, false);
</script>
</pre>
</body>

View File

@ -14,19 +14,14 @@
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
var testframe = document.getElementById('testframe');
testframe.src = 'file_policyuri_regression_from_multipolicy.html';
testframe.addEventListener('load', function checkInlineScriptExecuted () {
is(this.contentDocument.getElementById('testdiv').innerHTML,
'Inline Script Executed',
'Inline script should execute (it would be blocked by the policy, but the policy is report-only)');
SimpleTest.finish();
});
}
);
var testframe = document.getElementById('testframe');
testframe.src = 'file_policyuri_regression_from_multipolicy.html';
testframe.addEventListener('load', function checkInlineScriptExecuted () {
is(this.contentDocument.getElementById('testdiv').innerHTML,
'Inline Script Executed',
'Inline script should execute (it would be blocked by the policy, but the policy is report-only)');
SimpleTest.finish();
});
</script>
</body>
</html>

View File

@ -40,11 +40,7 @@ SpecialPowers.registerConsoleListener(function ConsoleMsgListener(aMsg) {
// set up and start testing
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set': [["security.csp.speccompliant", true]]},
function() {
document.getElementById('cspframe').src = 'file_report_uri_missing_in_report_only_header.html';
});
document.getElementById('cspframe').src = 'file_report_uri_missing_in_report_only_header.html';
</script>
</pre>
</body>

View File

@ -47,12 +47,8 @@ SpecialPowers.registerConsoleListener(function ConsoleMsgListener(aMsg) {
// set up and start testing
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set': [["security.csp.speccompliant", true]]},
function() {
document.getElementById('cspframe').src = 'file_self_none_as_hostname_confusion.html';
startTest = true;
});
document.getElementById('cspframe').src = 'file_self_none_as_hostname_confusion.html';
startTest = true;
</script>
</pre>
</body>

View File

@ -27,11 +27,7 @@ function checkResult()
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function() {
document.getElementById('i').src = 'file_subframe_run_js_if_allowed.html';
});
document.getElementById('i').src = 'file_subframe_run_js_if_allowed.html';
</script>
</body>
</html>