Title: [102614] branches/chromium/963
- Revision
- 102614
- Author
- [email protected]
- Date
- 2011-12-12 13:26:28 -0800 (Mon, 12 Dec 2011)
Log Message
Merge 102602 - Source/WebCore: A SubresourceLoader in the middle of revalidating
a resource should be treated as finishing (similar to
didFinishLoading and didFail) to ensure that willCancel()
doesn't declare the revalidation as having failed reentrantly.
https://bugs.webkit.org/show_bug.cgi?id=72762
Reviewed by Adam Barth.
Test: http/tests/cache/cancel-during-revalidation-succeeded.html
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=72762
Reviewed by Adam Barth.
* http/tests/cache/cancel-during-revalidation-succeeded-expected.txt: Added.
* http/tests/cache/cancel-during-revalidation-succeeded.html: Added.
* http/tests/cache/resources/stylesheet304.php: Added.
[email protected]
Review URL: http://codereview.chromium.org/8920011
Modified Paths
Added Paths
Diff
Copied: branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded-expected.txt (from rev 102602, trunk/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded-expected.txt) (0 => 102614)
--- branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded-expected.txt (rev 0)
+++ branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded-expected.txt 2011-12-12 21:26:28 UTC (rev 102614)
@@ -0,0 +1 @@
+It's possible for a successful revalidation to cause events to fire synchronously. We shouldn't crash if one of those events stops the load. See https://bugs.webkit.org/show_bug.cgi?id=72762.
Copied: branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded.html (from rev 102602, trunk/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded.html) (0 => 102614)
--- branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded.html (rev 0)
+++ branches/chromium/963/LayoutTests/http/tests/cache/cancel-during-revalidation-succeeded.html 2011-12-12 21:26:28 UTC (rev 102614)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<link id="img" rel="stylesheet" href=""
+</head>
+<body>
+It's possible for a successful revalidation to cause events to fire synchronously.
+We shouldn't crash if one of those events stops the load.
+See https://bugs.webkit.org/show_bug.cgi?id=72762.
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function obl(e) {
+ if (window.sessionStorage.getItem("reloaded")) {
+ window.stop();
+ window.sessionStorage.removeItem("reloaded");
+ setTimeout(finish, 0);
+ } else {
+ window.sessionStorage.reloaded = "true";
+ location.reload();
+ }
+}
+
+function finish() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
+<object type="application/x-no-such-mime" _onbeforeload_="obl();"></embed>
+</body>
+</html>
\ No newline at end of file
Copied: branches/chromium/963/LayoutTests/http/tests/cache/resources/stylesheet304.php (from rev 102602, trunk/LayoutTests/http/tests/cache/resources/stylesheet304.php) (0 => 102614)
--- branches/chromium/963/LayoutTests/http/tests/cache/resources/stylesheet304.php (rev 0)
+++ branches/chromium/963/LayoutTests/http/tests/cache/resources/stylesheet304.php 2011-12-12 21:26:28 UTC (rev 102614)
@@ -0,0 +1,21 @@
+<?php
+require_once '../../resources/portabilityLayer.php';
+
+clearstatcache();
+
+if ($_SERVER["HTTP_IF_MODIFIED_SINCE"]) {
+ header("HTTP/1.0 304 Not Modified");
+ exit();
+}
+$_one_year_ = 12 * 31 * 24 * 60 * 60;
+$last_modified = gmdate(DATE_RFC1123, time() - $one_year);
+$expires = gmdate(DATE_RFC1123, time() + $one_year);
+
+header('Cache-Control: public, max-age=' . $one_year);
+header('Expires: ' . $expires);
+header('Content-Type: text/css');
+header('Content-Length: 0');
+header('Etag: 123456789');
+header('Last-Modified: ' . $last_modified);
+exit();
+?>
Modified: branches/chromium/963/Source/WebCore/loader/SubresourceLoader.cpp (102613 => 102614)
--- branches/chromium/963/Source/WebCore/loader/SubresourceLoader.cpp 2011-12-12 21:25:04 UTC (rev 102613)
+++ branches/chromium/963/Source/WebCore/loader/SubresourceLoader.cpp 2011-12-12 21:26:28 UTC (rev 102614)
@@ -156,8 +156,12 @@
if (response.httpStatusCode() == 304) {
// 304 Not modified / Use local copy
// Existing resource is ok, just use it updating the expiration time.
+ m_state = Revalidating;
memoryCache()->revalidationSucceeded(m_resource, response);
- ResourceLoader::didReceiveResponse(response);
+ if (!reachedTerminalState()) {
+ ResourceLoader::didReceiveResponse(response);
+ didFinishLoading(currentTime());
+ }
return;
}
// Did not get 304 response, continue as a regular resource load.
@@ -240,7 +244,7 @@
void SubresourceLoader::didFinishLoading(double finishTime)
{
- if (m_state != Initialized)
+ if (m_state != Initialized && m_state != Revalidating)
return;
ASSERT(!reachedTerminalState());
ASSERT(!m_resource->resourceToRevalidate());
Modified: branches/chromium/963/Source/WebCore/loader/SubresourceLoader.h (102613 => 102614)
--- branches/chromium/963/Source/WebCore/loader/SubresourceLoader.h 2011-12-12 21:25:04 UTC (rev 102613)
+++ branches/chromium/963/Source/WebCore/loader/SubresourceLoader.h 2011-12-12 21:26:28 UTC (rev 102614)
@@ -76,6 +76,7 @@
enum SubresourceLoaderState {
Uninitialized,
Initialized,
+ Revalidating,
Finishing,
Releasing
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes