tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

media-src-7_1.html (1636B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4    <title>Video element src attribute must match src list - positive test</title>
      5    <meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline'; media-src 'self'">
      6    <script src='/resources/testharness.js'></script>
      7    <script src='/resources/testharnessreport.js'></script>
      8 </head>
      9 <body>
     10    <h1>Video element src attribute must match src list - positive test</h1>
     11    <div id='log'></div>
     12 
     13  <script>
     14    var src_test = async_test("In-policy async video src");
     15    var source_test = async_test("In-policy async video source element");
     16    var t_spv = async_test("Should not fire policy violation events");
     17    var test_count = 2;
     18    window.addEventListener("securitypolicyviolation", t_spv.unreached_func("Should not have fired any event"));
     19 
     20    function media_loaded(t) {
     21      t.done();
     22      if (--test_count <= 0) {
     23        t_spv.done();
     24      }
     25    }
     26 
     27    function media_error_handler(t) {
     28      t.step( function () {
     29          assert_unreached("Media error handler should be triggered for non-allowed domain.");
     30      });
     31      t.done();
     32    }
     33  </script>
     34 
     35    <video id="videoObject" width="320" height="240" controls
     36           onloadeddata="media_loaded(source_test)">
     37        <source id="videoSourceObject"
     38                type="video/webm"
     39                onerror="media_error_handler(source_test)"
     40                src="/media/A4.webm">
     41    </video>
     42    <video id="videoObject2" width="320" height="240" controls
     43           onerror="media_error_handler(src_test)"
     44           onloadeddata="media_loaded(src_test)"
     45           src="/media/A4.webm">
     46 
     47 </body>
     48 </html>