tor-browser

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

internal-stylesheet.html (1703B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS integration - Font from internal stylesheet</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 internal stylesheets are loaded with
     14    the referrer and referrer policy from the document.</p>
     15 
     16    <div class="styled"></div>
     17 
     18    <script>
     19      promise_test(function(css_test) {
     20        let id = token();
     21        let css_url = location.protocol + "//www1." + location.hostname + ":" +
     22                      location.port +
     23                      "/common/security-features/subresource/font.py" + "?id=" +
     24                      id + "&type=font";
     25        let font_url = css_url + "&report-headers";
     26 
     27        let style = document.createElement("style");
     28        style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}";
     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, location.origin + "/");
     36            });
     37      }, "Font from internal stylesheet.");
     38    </script>
     39 
     40    <div id="log"></div>
     41  </body>
     42 </html>