<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script>
description("A cached page with a URL fragment shouldn't send the fragment in the referrer");

if (window.testRunner) {
    testRunner.clearBackForwardList();
    testRunner.dumpAsText();

    testRunner.queueLoad('resources/success.html');
    testRunner.queueBackNavigation(1);
}

const locationWithoutHash = document.location.href;

document.location = '#fragment';

window.addEventListener('pageshow', () => {
    xhr = new XMLHttpRequest();
    xhr.open('GET', 'resources/referrer.py', false);
    xhr.send(null);
    shouldBeEqualToString('xhr.responseText', locationWithoutHash);
});
</script>
</head>
<body>
</body>
<script src="../resources/js-test-post.js"></script>
</head>
</html>
