tor-browser

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

processing-instruction.html (2040B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS integration - Font from external stylesheet inserted via a ProcessingInstruction</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <script src="/common/utils.js"></script>
      8    <!-- Common global functions for referrer-policy tests. -->
      9    <script src="/common/security-features/resources/common.sub.js"></script>
     10    <meta name="referrer" content="never">
     11  </head>
     12  <body>
     13    <p>Check that resources from external stylesheets (referenced from a
     14    ProcessingInstruction) are loaded with the referrer and referrer policy
     15    from the external stylesheet.</p>
     16 
     17    <div class="styled"></div>
     18 
     19    <script>
     20      promise_test(function(css_test) {
     21        let id = token();
     22        let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
     23        let css_url = url_prefix +
     24                      "/common/security-features/subresource/stylesheet.py?id=" +
     25                      id + "&amp;type=font";
     26        let expected = url_prefix +
     27                      "/common/security-features/subresource/stylesheet.py?id=" +
     28                      id + "&type=font";
     29        let font_url = url_prefix + "/common/security-features/subresource/font.py" +
     30                       "?id=" + id + "&report-headers";
     31 
     32        let processingInstruction =
     33          document.createProcessingInstruction(
     34            "xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
     35        document.insertBefore(processingInstruction, document.firstChild);
     36        return timeoutPromise(css_test, 1000)
     37          .then(() => requestViaXhr(font_url))
     38          .then(function(message) {
     39              assert_own_property(message, "headers");
     40              assert_own_property(message, "referrer");
     41              assert_equals(message.referrer, expected);
     42            });
     43      }, "Font from external stylesheet (from ProcessingInstruction).");
     44    </script>
     45 
     46    <div id="log"></div>
     47  </body>
     48 </html>