forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1279420 - Adding in security.csp.experimentalEnabled pref check t…
…o require-sri-for directive in CSP. r=ckerschb MozReview-Commit-ID: 799ZZoW0YiG --HG-- extra : transplant_source : %CAC%12%16%C6a%10AP%BEc%85%BA%93Z%7Cq%D43%8D
- Loading branch information
Jonathan Kingston
committed
Jun 20, 2016
1 parent
e62bd5f
commit daa6f72
Showing
6 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
dom/security/test/sri/test_require-sri-for_csp_directive_disabled.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ | ||
--> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Test for diabled SRI require-sri-for CSP directive</title> | ||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> | ||
</head> | ||
<body> | ||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265318">Mozilla Bug 1265318</a> | ||
<iframe style="width:200px;height:200px;" id="test_frame"></iframe> | ||
</body> | ||
<script type="application/javascript"> | ||
SpecialPowers.setBoolPref("security.csp.experimentalEnabled", false); | ||
SimpleTest.waitForExplicitFinish(); | ||
function handler(event) { | ||
switch (event.data) { | ||
case 'good_sriLoaded': | ||
ok(true, "Eligible SRI resources was correctly loaded."); | ||
break; | ||
case 'bad_nonsriLoaded': | ||
ok(true, "Eligible non-SRI resource should be blocked by the CSP!"); | ||
break; | ||
case 'good_nonsriBlocked': | ||
ok(false, "Eligible non-SRI resources was correctly blocked by the CSP."); | ||
break; | ||
case 'finish': | ||
var blackText = frame.contentDocument.getElementById('black-text'); | ||
var blackTextColor = frame.contentWindow.getComputedStyle(blackText, null).getPropertyValue('color'); | ||
ok(blackTextColor != 'rgb(0, 0, 0)', "The second part should still be black."); | ||
removeEventListener('message', handler); | ||
SimpleTest.finish(); | ||
break; | ||
default: | ||
ok(false, 'Something is wrong here'); | ||
break; | ||
} | ||
} | ||
addEventListener("message", handler); | ||
var frame = document.getElementById("test_frame"); | ||
frame.src = "iframe_require-sri-for_main.html"; | ||
</script> | ||
</html> |