Reviewed by Sam Weinig.
Added layout tests for how many history items are created during a
redirect. (Many of these results are expected failures for now.)
* http/tests/history: Added.
* http/tests/history/redirect-200-refresh-0-seconds-expected.txt: Added.
* http/tests/history/redirect-200-refresh-0-seconds.pl: Added.
* http/tests/history/redirect-200-refresh-2-seconds-expected.txt: Added.
* http/tests/history/redirect-200-refresh-2-seconds.pl: Added.
* http/tests/history/redirect-301-expected.txt: Added.
* http/tests/history/redirect-301.pl: Added.
* http/tests/history/redirect-302-expected.txt: Added.
* http/tests/history/redirect-302.pl: Added.
* http/tests/history/redirect-303-expected.txt: Added.
* http/tests/history/redirect-303.pl: Added.
* http/tests/history/redirect-307-expected.txt: Added.
* http/tests/history/redirect-307.pl: Added.
* http/tests/history/redirect-js-document-location-0-seconds-expected.txt: Added.
* http/tests/history/redirect-js-document-location-0-seconds.html: Added.
* http/tests/history/redirect-js-document-location-2-seconds-expected.txt: Added.
* http/tests/history/redirect-js-document-location-2-seconds.html: Added.
* http/tests/history/redirect-js-document-location-before-load-expected.txt: Added.
* http/tests/history/redirect-js-document-location-before-load.html: Added.
* http/tests/history/redirect-js-location-0-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-0-seconds.html: Added.
* http/tests/history/redirect-js-location-2-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-2-seconds.html: Added.
* http/tests/history/redirect-js-location-assign-0-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-assign-0-seconds.html: Added.
* http/tests/history/redirect-js-location-assign-2-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-assign-2-seconds.html: Added.
* http/tests/history/redirect-js-location-assign-before-load-expected.txt: Added.
* http/tests/history/redirect-js-location-assign-before-load.html: Added.
* http/tests/history/redirect-js-location-before-load-expected.txt: Added.
* http/tests/history/redirect-js-location-before-load.html: Added.
* http/tests/history/redirect-js-location-href-0-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-href-0-seconds.html: Added.
* http/tests/history/redirect-js-location-href-2-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-href-2-seconds.html: Added.
* http/tests/history/redirect-js-location-href-before-load-expected.txt: Added.
* http/tests/history/redirect-js-location-href-before-load.html: Added.
* http/tests/history/redirect-js-location-replace-0-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-replace-0-seconds.html: Added.
* http/tests/history/redirect-js-location-replace-2-seconds-expected.txt: Added.
* http/tests/history/redirect-js-location-replace-2-seconds.html: Added.
* http/tests/history/redirect-js-location-replace-before-load-expected.txt: Added.
* http/tests/history/redirect-js-location-replace-before-load.html: Added.
* http/tests/history/redirect-meta-refresh-0-seconds-expected.txt: Added.
* http/tests/history/redirect-meta-refresh-0-seconds.html: Added.
* http/tests/history/redirect-meta-refresh-2-seconds-expected.txt: Added.
* http/tests/history/redirect-meta-refresh-2-seconds.html: Added.
* http/tests/history/resources: Added.
* http/tests/history/resources/redirect-target.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40331
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-01-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added layout tests for how many history items are created during a
+ redirect. (Many of these results are expected failures for now.)
+
+ * http/tests/history: Added.
+ * http/tests/history/redirect-200-refresh-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-200-refresh-0-seconds.pl: Added.
+ * http/tests/history/redirect-200-refresh-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-200-refresh-2-seconds.pl: Added.
+ * http/tests/history/redirect-301-expected.txt: Added.
+ * http/tests/history/redirect-301.pl: Added.
+ * http/tests/history/redirect-302-expected.txt: Added.
+ * http/tests/history/redirect-302.pl: Added.
+ * http/tests/history/redirect-303-expected.txt: Added.
+ * http/tests/history/redirect-303.pl: Added.
+ * http/tests/history/redirect-307-expected.txt: Added.
+ * http/tests/history/redirect-307.pl: Added.
+ * http/tests/history/redirect-js-document-location-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-document-location-0-seconds.html: Added.
+ * http/tests/history/redirect-js-document-location-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-document-location-2-seconds.html: Added.
+ * http/tests/history/redirect-js-document-location-before-load-expected.txt: Added.
+ * http/tests/history/redirect-js-document-location-before-load.html: Added.
+ * http/tests/history/redirect-js-location-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-0-seconds.html: Added.
+ * http/tests/history/redirect-js-location-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-2-seconds.html: Added.
+ * http/tests/history/redirect-js-location-assign-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-assign-0-seconds.html: Added.
+ * http/tests/history/redirect-js-location-assign-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-assign-2-seconds.html: Added.
+ * http/tests/history/redirect-js-location-assign-before-load-expected.txt: Added.
+ * http/tests/history/redirect-js-location-assign-before-load.html: Added.
+ * http/tests/history/redirect-js-location-before-load-expected.txt: Added.
+ * http/tests/history/redirect-js-location-before-load.html: Added.
+ * http/tests/history/redirect-js-location-href-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-href-0-seconds.html: Added.
+ * http/tests/history/redirect-js-location-href-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-href-2-seconds.html: Added.
+ * http/tests/history/redirect-js-location-href-before-load-expected.txt: Added.
+ * http/tests/history/redirect-js-location-href-before-load.html: Added.
+ * http/tests/history/redirect-js-location-replace-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-replace-0-seconds.html: Added.
+ * http/tests/history/redirect-js-location-replace-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-js-location-replace-2-seconds.html: Added.
+ * http/tests/history/redirect-js-location-replace-before-load-expected.txt: Added.
+ * http/tests/history/redirect-js-location-replace-before-load.html: Added.
+ * http/tests/history/redirect-meta-refresh-0-seconds-expected.txt: Added.
+ * http/tests/history/redirect-meta-refresh-0-seconds.html: Added.
+ * http/tests/history/redirect-meta-refresh-2-seconds-expected.txt: Added.
+ * http/tests/history/redirect-meta-refresh-2-seconds.html: Added.
+ * http/tests/history/resources: Added.
+ * http/tests/history/resources/redirect-target.html: Added.
+
2009-01-28 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a Refresh header HTTP redirect
+
+print "Status: 200 ok\r\n";
+print "Refresh: 0; url=resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>200 Refresh Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a 200 refresh redirect on a 0 second delay.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a Refresh header HTTP redirect
+
+print "Status: 200 ok\r\n";
+print "Refresh: 2; url=resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>200 Refresh Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a 200 refresh redirect on a 2 second delay.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a 301 HTTP redirect
+
+print "Status: 301 Moved Permanently\r\n";
+print "Location: resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>301 Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a 301 redirect.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a 302 HTTP redirect
+
+print "Status: 302 Moved Temporarily\r\n";
+print "Location: resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>302 Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a 302 redirect.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a 303 HTTP redirect
+
+print "Status: 303 See Other\r\n";
+print "Location: resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>303 Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a 303 redirect.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+#!/usr/bin/perl
+# Script to generate a 307 HTTP redirect
+
+print "Status: 307 Moved Temporarily\r\n";
+print "Location: resources/redirect-target.html?1\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print <<HERE_DOC_END
+<html>
+<head>
+<title>307 Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+</head>
+
+<body>This page is a 307 redirect.</body>
+</html>
+HERE_DOC_END
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { document.location = "resources/redirect-target.html?1"; }, 0);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { document.location = "resources/redirect-target.html?1"; }, 2000);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+document.location = "resources/redirect-target.html?1";
+</script>
+</head>
+
+<body>This page is a JavaScript redirect.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location = "resources/redirect-target.html?1"; }, 0);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location = "resources/redirect-target.html?1"; }, 2000);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.assign("resources/redirect-target.html?1"); }, 0);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.assign("resources/redirect-target.html?1"); }, 2000);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+location.assign("resources/redirect-target.html?1");
+</script>
+</head>
+
+<body>This page is a JavaScript redirect.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+location = "resources/redirect-target.html?1";
+</script>
+</head>
+
+<body>This page is a JavaScript redirect.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.href = "resources/redirect-target.html?1"; }, 0);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.href = "resources/redirect-target.html?1"; }, 2000);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+location.href = "resources/redirect-target.html?1";
+</script>
+</head>
+
+<body>This page is a JavaScript redirect.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.replace("resources/redirect-target.html?1"); }, 0);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+setTimeout(function () { location.replace("resources/redirect-target.html?1"); }, 2000);
+</script>
+</head>
+
+<body>This page is a JavaScript redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+<html>
+<head>
+<title>JavaScript Redirect</title>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+location.replace("resources/redirect-target.html?1");
+</script>
+</head>
+
+<body>This page is a JavaScript redirect.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+PASS: History item count should be 1 and is.
+
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Refresh" content="0; url=resources/redirect-target.html?1">
+<title>Meta Refresh Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a meta refresh redirect on a 0 second delay.</body>
+</html>
--- /dev/null
+This page is the target of a redirect.
+
+FAIL: History item count should be 1 but instead is 2.
+
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Refresh" content="2; url=resources/redirect-target.html?1">
+<title>Meta Refresh Redirect</title>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.keepWebHistory();
+ layoutTestController.waitUntilDone();
+}
+</script>
+
+<body>This page is a meta refresh redirect on a 2 second delay.</body>
+</html>
--- /dev/null
+<!-- This page accepts a query string specifying how many history items should
+be present once it finishes loading. -->
+
+<html>
+<head>
+<title>Redirect Target</title>
+
+<script>
+function log(s)
+{
+ document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
+}
+
+function testHistoryItemCount()
+{
+ var expected = parseInt(location.search.slice(1));
+ var actual = layoutTestController.webHistoryItemCount + 1; // Add one to include the referring page, which loaded before we started recording history.
+ if (actual === expected)
+ log("PASS: History item count should be " + expected + " and is.");
+ else
+ log("FAIL: History item count should be " + expected + " but instead is " + actual + ".");
+}
+
+window.addEventListener("load", function () {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ testHistoryItemCount();
+ layoutTestController.notifyDone();
+ }
+}, false);
+</script>
+</head>
+
+<body>
+<p>This page is the target of a redirect.</p>
+<pre id="console"></pre>
+</body>
+</html>