Diff
Modified: trunk/LayoutTests/ChangeLog (148928 => 148929)
--- trunk/LayoutTests/ChangeLog 2013-04-22 23:27:30 UTC (rev 148928)
+++ trunk/LayoutTests/ChangeLog 2013-04-22 23:28:59 UTC (rev 148929)
@@ -1,3 +1,24 @@
+2013-04-22 Brady Eidson <[email protected]>
+
+ REGRESSION (r141136): Wiki "Random article" function very broken.
+ <rdar://problem/13229985> and https://bugs.webkit.org/show_bug.cgi?id=114480
+
+ Reviewed by Alexey Proskuryakov.
+
+ * http/tests/navigation/redirect-to-random-url-versus-memory-cache-expected.txt: Added.
+ * http/tests/navigation/redirect-to-random-url-versus-memory-cache.html: Added.
+ * http/tests/navigation/resources/randomredirects/0.php: Added.
+ * http/tests/navigation/resources/randomredirects/1.php: Added.
+ * http/tests/navigation/resources/randomredirects/2.php: Added.
+ * http/tests/navigation/resources/randomredirects/3.php: Added.
+ * http/tests/navigation/resources/randomredirects/4.php: Added.
+ * http/tests/navigation/resources/randomredirects/5.php: Added.
+ * http/tests/navigation/resources/randomredirects/6.php: Added.
+ * http/tests/navigation/resources/randomredirects/7.php: Added.
+ * http/tests/navigation/resources/randomredirects/8.php: Added.
+ * http/tests/navigation/resources/randomredirects/9.php: Added.
+ * http/tests/navigation/resources/randomredirects/randomredirect.php: Added.
+
2013-04-22 Rashmi Shyamasundar <[email protected]>
[Cairo] Canvas-shadow behavior is not being as expected
Added: trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache-expected.txt (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache-expected.txt 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,10 @@
+ALERT: Success: A different page was loaded at least once.
+This test clicks a link that loads a URL into an iframe.
+The URL redirects to a different, random URL every time the link is clicked.
+When main resources are in the memory cache they are keyed off the original URL, not the post-redirect URL.
+In the case where the redirect takes us to a different URL than the CachedResource we're revalidating, we need to abort the revalidate and issue an unconditional request.
+
+This test makes sure that trying the random redirect multiple times results in at least one different load result.
+Since the nature of this test is "random redirects", it runs enough multiple iterations to make it very likely we'll get at least one different redirect.
+Click for random redirect
+
Added: trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache.html (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/redirect-to-random-url-versus-memory-cache.html 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,62 @@
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var iterationCount = 0;
+var maxIterations = 20;
+var firstFrameText = null;
+var foundDifferentTextAtLeastOnce = false;
+
+function runIteration()
+{
+ setTimeout(function() {
+ if (window.eventSender) {
+ var el = document.getElementById("testLink");
+ eventSender.mouseMoveTo(el.offsetLeft + 5, el.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ }, 0);
+}
+
+function frameLoaded()
+{
+ if (frames[0].document.URL == "about:blank")
+ return;
+
+ if (firstFrameText == null)
+ firstFrameText = frames[0].document.body.innerText;
+
+ if (firstFrameText != frames[0].document.body.innerText)
+ foundDifferentTextAtLeastOnce = true;
+
+ ++iterationCount;
+
+ if (iterationCount == maxIterations) {
+ if (foundDifferentTextAtLeastOnce)
+ alert("Success: A different page was loaded at least once.");
+ else
+ alert("Failure: From the perspective of this script, the same page was loaded " + maxIterations + " times. This is highly unlikely.");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ } else {
+ runIteration();
+ }
+}
+
+</script>
+<body _onload_="runIteration();">
+This test clicks a link that loads a URL into an iframe.<br>
+The URL redirects to a different, random URL every time the link is clicked.<br>
+When main resources are in the memory cache they are keyed off the original URL, not the post-redirect URL.<br>
+In the case where the redirect takes us to a different URL than the CachedResource we're revalidating, we need to abort the revalidate and issue an unconditional request.<br>
+<br>
+This test makes sure that trying the random redirect multiple times results in at least one different load result.<br>
+Since the nature of this test is "random redirects", it runs enough multiple iterations to make it very likely we'll get at least one different redirect.<br>
+<a id="testLink" href="" target="linkTarget">Click for random redirect</a><br>
+<iframe name="linkTarget" _onload_="frameLoaded();"><br>
+</body>
+
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/0.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/0.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/0.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 0.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/1.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/1.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/1.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 1.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/2.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/2.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/2.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 2.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/3.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/3.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/3.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 3.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/4.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/4.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/4.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 4.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/5.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/5.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/5.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 5.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/6.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/6.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/6.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 6.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/7.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/7.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/7.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 7.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/8.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/8.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/8.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 8.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/9.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/9.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/9.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,16 @@
+<?php
+
+if (array_key_exists("If-Modified-Since", apache_request_headers())) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ exit;
+} else {
+ header('Content-Type: text/html; charset=utf-8');
+ header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+ header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+ header('Vary: Accept-Encoding, Cookie');
+ header('Last-Modified: Mon, 1 Apr 2013 12:12:12 GMT');
+}
+
+?>
+You're on page 9.php
Added: trunk/LayoutTests/http/tests/navigation/resources/randomredirects/randomredirect.php (0 => 148929)
--- trunk/LayoutTests/http/tests/navigation/resources/randomredirects/randomredirect.php (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/randomredirects/randomredirect.php 2013-04-22 23:28:59 UTC (rev 148929)
@@ -0,0 +1,11 @@
+<?php
+
+header('HTTP/1.1 302 Moved Temporarily');
+header('Content-Type: text/html; charset=utf-8');
+header('Cache-Control: private, s-maxage=0, max-age=0, must-revalidate');
+header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
+header('Vary: Accept-Encoding, Cookie');
+header('Connection: keep-alive');
+header('Location: ' . rand(0, 9) . '.php');
+
+?>
Modified: trunk/Source/WebCore/ChangeLog (148928 => 148929)
--- trunk/Source/WebCore/ChangeLog 2013-04-22 23:27:30 UTC (rev 148928)
+++ trunk/Source/WebCore/ChangeLog 2013-04-22 23:28:59 UTC (rev 148929)
@@ -1,3 +1,26 @@
+2013-04-22 Brady Eidson <[email protected]>
+
+ REGRESSION (r141136): Wiki "Random article" function very broken.
+ <rdar://problem/13229985> and https://bugs.webkit.org/show_bug.cgi?id=114480
+
+ Reviewed by Alexey Proskuryakov.
+
+ Test: http/tests/navigation/redirect-to-random-url-versus-memory-cache.html
+
+ If we are performing a conditional GET to revalidate a resource and there's a redirect,
+ check to see if the redirect is to a different URL than the final URL of the resource.
+
+ If the URLs differ then we should make the redirect-request unconditional and do a normal load.
+
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequest):
+
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::makeUnconditional):
+
+ * platform/network/ResourceRequestBase.h:
+ (ResourceRequestBase):
+
2013-04-22 Benjamin Poulain <[email protected]>
Mac debug build fix after r148921
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (148928 => 148929)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2013-04-22 23:27:30 UTC (rev 148928)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2013-04-22 23:28:59 UTC (rev 148929)
@@ -123,6 +123,13 @@
ASSERT(!newRequest.isNull());
if (!redirectResponse.isNull()) {
+ // If this redirect takes us somewhere besides the final response URL of the resource we're revalidating,
+ // then make this an unconditional GET request.
+ if (newRequest.isConditional() && m_resource->resourceToRevalidate() && newRequest.url() != m_resource->resourceToRevalidate()->response().url()) {
+ newRequest.makeUnconditional();
+ memoryCache()->revalidationFailed(m_resource);
+ }
+
if (!m_documentLoader->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
cancel();
return;
Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (148928 => 148929)
--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2013-04-22 23:27:30 UTC (rev 148928)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2013-04-22 23:28:59 UTC (rev 148929)
@@ -472,6 +472,15 @@
m_httpHeaderFields.contains("If-Unmodified-Since"));
}
+void ResourceRequestBase::makeUnconditional()
+{
+ m_httpHeaderFields.remove("If-Match");
+ m_httpHeaderFields.remove("If-Modified-Since");
+ m_httpHeaderFields.remove("If-None-Match");
+ m_httpHeaderFields.remove("If-Range");
+ m_httpHeaderFields.remove("If-Unmodified-Since");
+}
+
double ResourceRequestBase::defaultTimeoutInterval()
{
return s_defaultTimeoutInterval;
Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (148928 => 148929)
--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h 2013-04-22 23:27:30 UTC (rev 148928)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h 2013-04-22 23:28:59 UTC (rev 148929)
@@ -123,6 +123,7 @@
void setPriority(ResourceLoadPriority);
bool isConditional() const;
+ void makeUnconditional();
// Whether the associated ResourceHandleClient needs to be notified of
// upload progress made for that resource.