blob: 0f23f3b539b064178df159cafd53f6e1584cae35 [file] [log] [blame]
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="i" src="resources/no-referrer-meta.html"></iframe>
<script>
promise_test(async (t) => {
// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
await new Promise(r => window.onload = () => t.step_timeout(r, 0));
await i.contentWindow.appHistory.navigate("#hash");
assert_equals(i.contentWindow.appHistory.entries().length, 2);
// The entries for no-referrer.html should have the url censored.
i.contentWindow.appHistory.navigate("/common/blank.html");
await new Promise(r => i.onload = () => t.step_timeout(r, 0));
assert_equals(i.contentWindow.appHistory.entries().length, 3);
assert_equals(i.contentWindow.appHistory.current.index, 2);
assert_equals(i.contentWindow.appHistory.entries()[0].url, null);
assert_equals(i.contentWindow.appHistory.entries()[1].url, null);
// Navigating back to no-referrer.html should uncensor the urls.
i.contentWindow.appHistory.back();
await new Promise(r => i.onload = () => t.step_timeout(r, 0));
assert_equals(i.contentWindow.appHistory.entries().length, 3);
assert_equals(i.contentWindow.appHistory.current.index, 1);
assert_equals(new URL(i.contentWindow.appHistory.entries()[0].url).pathname,
"/app-history/app-history-entry/resources/no-referrer-meta.html");
assert_equals(new URL(i.contentWindow.appHistory.entries()[1].url).pathname,
"/app-history/app-history-entry/resources/no-referrer-meta.html");
}, "The url of a document with no-referrer referrer meta tag is censored in AppHistoryEntry");
</script>