<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

var maxEventLoopRuns = 50;
function helperLoaded () {
    if (!maxEventLoopRuns) {
        if (helper.location == "http://127.0.0.1:8000/contentextensions/resources/block-everything-unless-domain-helper.html")
            console.log("PASS - blocked the load");
        else
            console.log("FAIL - loaded blocked URL");
        testRunner.notifyDone();
    } else {
        setTimeout(helperLoaded, 1);
        maxEventLoopRuns--;
    }
}

var helper = window.open("resources/block-everything-unless-domain-helper.html");
if (helper)
    helper.addEventListener('load', helperLoaded);
else {
    console.log("opening window failed");
    testRunner.notifyDone();
}
</script>
