<!DOCTYPE html>
<head>
<title>Test console messages for serving constraints violation of subresource Web Bundles</title>
</head>
<body>
<script>
(async () => {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
// Delay running the test until "didFinishLoadForFrame" is printed.
// This is intended to avoid the flakiness of the result outputs.
await new Promise((resolve) => {
window.addEventListener('load', () => setTimeout(resolve, 0));
});
if (!HTMLScriptElement.supports('webbundle')) {
console.error("Subresource Web Bundles is not supported");
testRunner.notifyDone();
return;
}
await new Promise((resolve, reject) => {
const script = document.createElement('script');
script.type = 'webbundle';
script.textContent = JSON.stringify({
source: '../resources/wbn/hello.wbn-wrong-mime-type'
});
script.addEventListener('error', resolve);
document.body.appendChild(script);
});
await new Promise((resolve, reject) => {
const script = document.createElement('script');
script.type = 'webbundle';
script.textContent = JSON.stringify({
source: '../resources/wbn/hello.wbn-without-nosniff'
});
script.onerror = () => {
// Wait for the console message to be logged.
setTimeout(resolve, 100);
}
document.body.appendChild(script);
});
testRunner.notifyDone();
})();
</script>
</body>