tor-browser

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

processing-instruction.html (1800B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS integration - child css 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="origin">
     11  </head>
     12  <body>
     13    <p>Check that child css are loaded with the referrer and referrer policy the
     14    external stylesheet(referenced from a ProcessingInstruction).</p>
     15    <div class="styled"></div>
     16 
     17    <script>
     18      promise_test(function(css_test) {
     19        let id = token();
     20        let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
     21                         location.port +
     22                         "/common/security-features/subresource/stylesheet.py?id=" +
     23                         id;
     24        let css_url = url_prefix + "&amp;import-rule";
     25        let expected = url_prefix + "&import-rule";
     26        let check_url = url_prefix + "&report-headers";
     27 
     28        let processingInstruction =
     29          document.createProcessingInstruction(
     30            "xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
     31        document.insertBefore(processingInstruction, document.firstChild);
     32        return timeoutPromise(css_test, 1000)
     33          .then(() => requestViaXhr(check_url))
     34          .then(function(message) {
     35                assert_own_property(message, "headers");
     36                assert_own_property(message, "referrer");
     37                assert_equals(message.referrer, expected);
     38            });
     39      }, "Child css via a ProcessingInstruction.");
     40    </script>
     41 
     42    <div id="log"></div>
     43  </body>
     44 </html>