summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/referrer-policy/generic/meta-tag-in-svg-image.html
blob: 5bdc2c1abfa82777bac25b03a583898c51585ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
  <head>
    <title>Referrer Policy: Meta tag in svg image loaded via img should not change referrer policy</title>
    <meta name="referrer" content="origin"/>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <!-- Common global functions for referrer-policy tests. -->
    <script src="/common/security-features/resources/common.sub.js"></script>
  </head>
  <body>
    <script>
      async_test(function(t) {
        var img = document.createElement("img");
        img.onload = function() {
          var urlPath = '/common/security-features/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
          return requestViaImage(urlPath, null, 'always')
            .then(t.step_func(function(message) {
              assert_equals(message.referrer, self.origin + '/');
            }))
            .finally(function() { t.done(); });
        };
        img.onerror = t.step_func_done(function() {
          assert_unreached("img should load");
        });
        img.src = "./resources/img-with-referrer-policy.svg";
        document.body.appendChild(img);
      }, "Meta tag in SVG image loaded via img should be ignored");
    </script>
  </body>
</html>