| <!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 (!document.createElement('link').relList.supports('webbundle')) { |
| console.error("Subresource Web Bundles is not supported"); |
| testRunner.notifyDone(); |
| return; |
| } |
| |
| await new Promise((resolve, reject) => { |
| const link = document.createElement('link'); |
| link.rel = 'webbundle'; |
| link.href = '../resources/wbn/hello.wbn-wrong-mime-type'; |
| link.addEventListener('error', resolve); |
| document.body.appendChild(link); |
| }); |
| |
| await new Promise((resolve, reject) => { |
| const link = document.createElement('link'); |
| link.rel = 'webbundle'; |
| link.href = '../resources/wbn/hello.wbn-without-nosniff'; |
| link.addEventListener('error', resolve); |
| document.body.appendChild(link); |
| }); |
| |
| testRunner.notifyDone(); |
| })(); |
| </script> |
| </body> |