<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Fetching a cross origin resource with a given referrer</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <script>
promise_test(function(t) {
    var url = "http://localhost:8000/resources/download-json-with-delay.py?iteration=1&delay=1&cors=true";
    return fetch(url, {"mode": "cors", "referrer": "http://127.0.0.1:8000/referrer"}).then((response) => {
        assert_equals(response.type, "cors");
        return response.arrayBuffer().then((arrayBuffer) => {
            assert_true(arrayBuffer.byteLength > 0);
        });
    });
}, 'Ensure setting a referrer does not cause preflighting');
    </script>
  </body>
</html>
