| <!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 track 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 video = document.createElement("video"); |
| userAgentShadowRoot.appendChild(video); |
| var track = document.createElement("track"); |
| video.appendChild(track); |
| |
| track.track.mode = "hidden"; |
| track.kind = "captions"; |
| track.onload = function () { |
| log("PASS track did load."); |
| testRunner.notifyDone(); |
| } |
| track.onerror = function () { |
| log("FAIL track did not load."); |
| testRunner.notifyDone(); |
| } |
| track.src = "../resources/track.vtt"; |
| } |
| |
| runTest(); |
| </script> |
| </body> |
| </html> |