| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta http-equiv="Content-Security-Policy" content="media-src 'none'; script-src 'unsafe-inline'"> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| </script> |
| </head> |
| <body> |
| <p>Tests that a HTML audio element, in a user agent shadow tree, is allowed to load when the page has CSP policy: <code>media-src 'none'</code>.</p> |
| <div id="shadow-host"></div> |
| <pre id="console"></pre> |
| <script> |
| function log(message) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| function runTest() |
| { |
| if (!window.testRunner || !window.internals) |
| return; |
| |
| var userAgentShadowRoot = internals.ensureUserAgentShadowRoot(document.getElementById("shadow-host")); |
| var audio = document.createElement("audio"); |
| userAgentShadowRoot.appendChild(audio); |
| |
| audio.onloadedmetadata = function () { |
| log("PASS did load audio metadata."); |
| testRunner.notifyDone(); |
| } |
| audio.onerror = function () { |
| log("FAIL did not load audio metadata."); |
| testRunner.notifyDone(); |
| } |
| audio.src = "http://localhost:8000/resources/balls-of-the-orient.aif"; |
| } |
| |
| runTest(); |
| </script> |
| </body> |
| </html> |