tor-browser

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

internal-import-stylesheet.html (1662B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS integration - Font from imported stylesheet (internal)</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 resources from stylesheets (imported from internal
     14    stylesheets) are loaded with the referrer and referrer policy from from the
     15    imported style sheet.</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 + ":" +
     23                         location.port + "/common/security-features/subresource/";
     24        let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
     25        let font_url = url_prefix + "font.py?report-headers&id=" + id;
     26 
     27        let style = document.createElement("style");
     28        style.textContent = "@import url('" + css_url + "');";
     29        document.head.appendChild(style);
     30        return timeoutPromise(css_test, 1000)
     31          .then(() => requestViaXhr(font_url))
     32          .then(function(message) {
     33              assert_own_property(message, "headers");
     34              assert_own_property(message, "referrer");
     35              assert_equals(message.referrer, css_url);
     36            });
     37      }, "Font from imported stylesheet (internal).");
     38    </script>
     39 
     40    <div id="log"></div>
     41  </body>
     42 </html>