Diff
Modified: branches/safari-602-branch/LayoutTests/ChangeLog (208457 => 208458)
--- branches/safari-602-branch/LayoutTests/ChangeLog 2016-11-09 19:40:37 UTC (rev 208457)
+++ branches/safari-602-branch/LayoutTests/ChangeLog 2016-11-09 19:44:06 UTC (rev 208458)
@@ -1,3 +1,22 @@
+2016-11-09 Matthew Hanson <[email protected]>
+
+ Merge r208437. rdar://problem/29032334
+
+ 2016-11-09 Chris Dumez <[email protected]>
+
+ [WK2] Network cache speculative revalidation can cause loads to hang
+ https://bugs.webkit.org/show_bug.cgi?id=164532
+ <rdar://problem/28519331>
+
+ Reviewed by Alex Christensen.
+
+ Add layout test coverage. The test hangs without the fix.
+
+ * http/tests/cache/disk-cache/speculative-validation/http-auth-expected.txt: Added.
+ * http/tests/cache/disk-cache/speculative-validation/http-auth.html: Added.
+ * http/tests/cache/disk-cache/speculative-validation/resources/frame-with-authenticated-resource.php: Added.
+ * http/tests/cache/disk-cache/speculative-validation/resources/resource-with-auth.php: Added.
+
2016-11-03 Matthew Hanson <[email protected]>
Merge r208314. rdar://problem/29084077
Added: branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth-expected.txt (0 => 208458)
--- branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth-expected.txt (rev 0)
+++ branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth-expected.txt 2016-11-09 19:44:06 UTC (rev 208458)
@@ -0,0 +1,13 @@
+127.0.0.1:8000 - didReceiveAuthenticationChallenge - Responding with testUsername:testPassword
+127.0.0.1:8000 - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet
+Tests speculative revalidation of authenticated resources.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS xhr.status is 401
+PASS Successfuly loaded.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth.html (0 => 208458)
--- branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth.html (rev 0)
+++ branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/http-auth.html 2016-11-09 19:44:06 UTC (rev 208458)
@@ -0,0 +1,51 @@
+<script src=""
+<script>
+description("Tests speculative revalidation of authenticated resources.");
+jsTestIsAsync = true;
+
+testRunner.setHandlesAuthenticationChallenges(true);
+testRunner.setAuthenticationUsername("testUsername");
+testRunner.setAuthenticationPassword("testPassword");
+
+state = "warmup";
+
+function clearCredentialStorage()
+{
+ xhr = new XMLHttpRequest();
+ xhr.open("GET", "resources/resource-with-auth.php?other", false, "badUsername", "badPassword");
+ xhr.send();
+ shouldBe("xhr.status", "401");
+}
+
+function frameLoaded()
+{
+ if (state == "warmup") {
+ // Navigate frame to 'about:blank' to flush to subresource loads metadata to disk.
+ state = "flushingMetadata";
+ testRunner.setHandlesAuthenticationChallenges(false);
+ document.getElementById("testFrame").src = ""
+ return;
+ }
+ if (state == "flushingMetadata") {
+ clearCredentialStorage();
+
+ internals.clearMemoryCache();
+ testRunner.setHandlesAuthenticationChallenges(false);
+
+ // Navigate frame to its original location again. This time it should speculatively
+ // validate subresources as we have subresource loads metadata in the disk cache.
+ state = "speculativeRevalidation";
+ document.getElementById("testFrame").src = ""
+ return;
+ }
+ if (state == "speculativeRevalidation") {
+ testPassed("Successfuly loaded.");
+
+ finishJSTest();
+ return;
+ }
+}
+
+</script>
+<iframe id="testFrame" src="" _onload_="frameLoaded()"></iframe>
+<script src=""
Added: branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/frame-with-authenticated-resource.php (0 => 208458)
--- branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/frame-with-authenticated-resource.php (rev 0)
+++ branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/frame-with-authenticated-resource.php 2016-11-09 19:44:06 UTC (rev 208458)
@@ -0,0 +1,10 @@
+<?php
+header('Content-Type: text/html');
+header('Cache-Control: max-age=0');
+header('Etag: 123456789');
+
+?>
+<!DOCTYPE html>
+<body>
+<script src=""
+</body>
Added: branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/resource-with-auth.php (0 => 208458)
--- branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/resource-with-auth.php (rev 0)
+++ branches/safari-602-branch/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/resource-with-auth.php 2016-11-09 19:44:06 UTC (rev 208458)
@@ -0,0 +1,18 @@
+<?php
+$expectedUsername = 'testUsername';
+$expectedPassword = 'testPassword';
+$realm = $_SERVER['REQUEST_URI'];
+
+header('Content-Type: text/_javascript_');
+header('Cache-Control: max-age=0');
+header('Etag: 123456789');
+
+if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $expectedUsername ||
+ !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_PW'] != $expectedPassword) {
+ header("WWW-Authenticate: Basic realm=\"" . $realm . "\"");
+ header('HTTP/1.0 401 Unauthorized');
+ print 'Sent username:password of (' . $_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW'] . ') which is not what was expected';
+ exit;
+}
+?>
+loaded = true;
Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (208457 => 208458)
--- branches/safari-602-branch/Source/WebKit2/ChangeLog 2016-11-09 19:40:37 UTC (rev 208457)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog 2016-11-09 19:44:06 UTC (rev 208458)
@@ -1,3 +1,24 @@
+2016-11-09 Matthew Hanson <[email protected]>
+
+ Merge r208437. rdar://problem/29032334
+
+ 2016-11-09 Chris Dumez <[email protected]>
+
+ [WK2] Network cache speculative revalidation can cause loads to hang
+ https://bugs.webkit.org/show_bug.cgi?id=164532
+ <rdar://problem/28519331>
+
+ Reviewed by Alex Christensen.
+
+ Network cache speculative revalidation could cause loads to hang when HTTP
+ authentication was involved because NetworkCacheSpeculativeLoad failed to
+ call NetworkLoad::continueCanAuthenticateAgainstProtectionSpace() in its
+ canAuthenticateAgainstProtectionSpaceAsync() callback.
+
+ * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
+ (WebKit::NetworkCache::SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync):
+ * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
+
2016-11-03 Matthew Hanson <[email protected]>
Merge r208328. rdar://problem/29084886
Modified: branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp (208457 => 208458)
--- branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp 2016-11-09 19:40:37 UTC (rev 208457)
+++ branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp 2016-11-09 19:44:06 UTC (rev 208458)
@@ -114,6 +114,11 @@
didComplete();
}
+void SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&)
+{
+ m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(false);
+}
+
void SpeculativeLoad::didFailLoading(const ResourceError&)
{
m_cacheEntryForValidation = nullptr;
Modified: branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h (208457 => 208458)
--- branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h 2016-11-09 19:40:37 UTC (rev 208457)
+++ branches/safari-602-branch/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h 2016-11-09 19:44:06 UTC (rev 208458)
@@ -54,7 +54,7 @@
private:
// NetworkLoadClient.
void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override { }
- void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override { }
+ void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;
bool isSynchronous() const override { return false; }
void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) override;
ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override;