tor-browser

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

iframe-csp-attribute.html (1108B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <script src="/resources/testharness.js"></script>
      5    <script src="/resources/testharnessreport.js"></script>
      6 </head>
      7 <body>
      8    <script>
      9      test(t => {
     10        var i = document.createElement('iframe');
     11        assert_equals('', i.csp);
     12        assert_true('csp' in i);
     13        assert_equals('string', typeof i.csp);
     14      }, "<iframe> has a 'csp' attibute which is an empty string if undefined.");
     15 
     16      test(t => {
     17        var i = document.createElement('iframe');
     18        i.setAttribute('csp', 123456);
     19        assert_equals('123456', i.csp);
     20      }, "<iframe>'s csp attribute is always a string.");
     21 
     22      test(t => {
     23        var i = document.createElement('iframe');
     24        i.csp = 'value';
     25        assert_equals('value', i.getAttribute('csp'));
     26      }, "<iframe>'s 'csp content attribute reflects the IDL attribute.");
     27 
     28      test(t => {
     29        var i = document.createElement('iframe');
     30        i.setAttribute('csp', 'value');
     31        assert_equals('value', i.csp);
     32      }, "<iframe>'s IDL attribute reflects the DOM attribute.");
     33  </script>
     34 </body>
     35 </html>