Bug 1387811 - Follow up for Test within Bug 1381761: CSP JSON is never null, hence it's better to check actual contents of JSON for testing. r=dveditz

This commit is contained in:
Christoph Kerschbaumer 2017-08-06 11:37:09 +02:00
Родитель a5f2311154
Коммит a1341ccf6d
2 изменённых файлов: 7 добавлений и 3 удалений

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

@ -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>

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

@ -22,7 +22,9 @@ SimpleTest.waitForExplicitFinish();
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();
}