blob: 103014922a059bda145cfba495b103616137b400 [file] [log] [blame]
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="frame-src 'self'">
<script>
async_test(t => {
var watcher = new EventWatcher(t, document, ['securitypolicyviolation']);
watcher
.wait_for('securitypolicyviolation')
.then(t.step_func(e => {
assert_equals(e.blockedURI, "http://localhost:8000", "The reported URL should be stripped.");
assert_equals(e.lineNumber, 21, "The script that triggered the navigation should be reported.");
t.done();
}));
window.onmessage = t.unreached_func('No message should be sent from the frame.');
window.onload = _ => {
var url = "resources/redir.php?url=http://localhost:8000/security/resources/post-done.html";
var i = document.createElement('iframe');
i.src = url;
document.body.appendChild(i);
};
}, "The redirected frame is blocked.");
</script>