Skip to content

Commit

Permalink
Bug 1387811 - Follow up for Test within Bug 1381761: CSP JSON is neve…
Browse files Browse the repository at this point in the history
…r null, hence it's better to check actual contents of JSON for testing. r=dveditz
  • Loading branch information
Christoph Kerschbaumer committed Aug 6, 2017
1 parent a5f2311 commit a1341cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions dom/security/test/csp/file_data_csp_inheritance.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
var frame = document.getElementById("dataFrame");
var principal = SpecialPowers.wrap(frame.contentDocument).nodePrincipal;
var cspJSON = principal.cspJSON;
var result = principal.cspJSON ? "dataInheritsCSP" : "dataDoesNotInheritCSP";
window.parent.postMessage({result}, "*");
var cspOBJ = JSON.parse(principal.cspJSON);
// make sure we got >>one<< policy
var policies = cspOBJ["csp-policies"];
window.parent.postMessage({result: policies.length}, "*");
</script>

</body>
Expand Down
4 changes: 3 additions & 1 deletion dom/security/test/csp/test_data_csp_inheritance.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
window.addEventListener("message", receiveMessage);
function receiveMessage(event) {
window.removeEventListener("message", receiveMessage);
is(event.data.result, "dataInheritsCSP",
// toplevel CSP should apply to data: URI iframe hence resulting
// in 1 applied policy.
is(event.data.result, 1,
"data: URI iframe inherits CSP from including context");
SimpleTest.finish();
}
Expand Down

0 comments on commit a1341cc

Please sign in to comment.