Bug 1586684 - Rewrite test_navigate_to.html to pass when fission enable r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D51096

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thomas Nguyen 2019-10-30 17:14:56 +00:00
parent 58a1a3d132
commit ac066415f5
2 changed files with 7 additions and 8 deletions

View File

@ -401,5 +401,4 @@ support-files =
support-files =
file_navigate_to.sjs
file_navigate_to_request.html
skip-if = fission # bug 1580643
[test_independent_iframe_csp.html]

View File

@ -112,13 +112,9 @@ function checkResult(aResult) {
// document (parent).
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy");
SpecialPowers.addObserver(this, "specialpowers-http-notify-request");
}
examiner.prototype = {
observe(subject, topic, data) {
if (topic === "specialpowers-http-notify-request" && data === "http://www.example.com/" ) {
checkResult("allowed");
}
if (topic === "csp-on-violate-policy" && data === "navigate-to") {
checkResult("blocked");
}
@ -126,10 +122,14 @@ examiner.prototype = {
},
remove() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}
window.NavigationActionExaminer = new examiner();
// We use iframe onload to check if requests are not blocked by CSP
var iframe = document.getElementById("testframe");
iframe.onload = function() {
checkResult("allowed");
}
function loadNextTest() {
counter++;
@ -147,7 +147,7 @@ function loadNextTest() {
}
src += "&target=" + escape(tests[counter].target);
document.getElementById("testframe").src = src;
iframe.src = src;
}
// start running the tests
@ -155,4 +155,4 @@ loadNextTest();
</script>
</body>
</html>
</html>