blob: bea8ff94d6521f403388aefc3a335599f0f93010 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
if (window.testRunner) {
// Inject a subresource filter to disallow 'beta.js' (but not 'alpha.js').
testRunner.setDisallowedSubresourcePathSuffixes(["beta.js"], true /* block_subresources */);
}
document.scriptsExecuted = [];
document.notifyScriptExecuted = function(basename) {
document.scriptsExecuted.push(basename);
}
async_test(t => {
var s = document.createElement("script");
s.onload = t.step_func_done(_ => {
assert_in_array("alpha", document.scriptsExecuted, "Scripts that are not disallowed are still executed.");
});
s.onerror = t.unreached_func();
s.src = "resources/alpha.js";
document.body.appendChild(s);
}, "Resources whose URLs are not disallowed are still loaded.");
async_test(t => {
var s = document.createElement("script");
s.onload = t.unreached_func();
s.onerror = t.step_func_done();
s.src = "resources/beta.js";
document.body.appendChild(s);
}, "Resources whose initial URL (not after redirects) are disallowed are not loaded.");
</script>
</body>
</html>