- Revision
- 195162
- Author
- [email protected]
- Date
- 2016-01-15 18:08:08 -0800 (Fri, 15 Jan 2016)
Log Message
FrameLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame() is never called when loading a main resource from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=152520
<rdar://problem/23305737>
Reviewed by Andy Estes.
Source/WebCore:
Test: http/tests/loading/server-redirect-for-provisional-load-caching.html
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
Dispatch message to notify client that a cached resource was redirected. So,
client can make proper actions to treat server side redirection.
* loader/cache/CachedRawResource.h:
Add a method to tell whether the cached resource was redirected.
LayoutTests:
* http/tests/loading/resources/server-redirect-result.html: Added.
* http/tests/loading/resources/server-redirect.php: Added.
* http/tests/loading/server-redirect-for-provisional-load-caching-expected.txt: Added.
* http/tests/loading/server-redirect-for-provisional-load-caching.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (195161 => 195162)
--- trunk/LayoutTests/ChangeLog 2016-01-16 01:55:03 UTC (rev 195161)
+++ trunk/LayoutTests/ChangeLog 2016-01-16 02:08:08 UTC (rev 195162)
@@ -1,3 +1,16 @@
+2016-01-15 Jiewen Tan <[email protected]>
+
+ FrameLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame() is never called when loading a main resource from the memory cache
+ https://bugs.webkit.org/show_bug.cgi?id=152520
+ <rdar://problem/23305737>
+
+ Reviewed by Andy Estes.
+
+ * http/tests/loading/resources/server-redirect-result.html: Added.
+ * http/tests/loading/resources/server-redirect.php: Added.
+ * http/tests/loading/server-redirect-for-provisional-load-caching-expected.txt: Added.
+ * http/tests/loading/server-redirect-for-provisional-load-caching.html: Added.
+
2016-01-15 Myles C. Maxfield <[email protected]>
Content blocking console messages are not deterministic for one test
Added: trunk/LayoutTests/http/tests/loading/resources/server-redirect-result.html (0 => 195162)
--- trunk/LayoutTests/http/tests/loading/resources/server-redirect-result.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resources/server-redirect-result.html 2016-01-16 02:08:08 UTC (rev 195162)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<script>
+if (parent.count == 0) {
+ parent.count = 1;
+ window.location = "server-redirect.php";
+}
+else if (parent.count == 1) {
+ if (parent.window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/loading/resources/server-redirect.php (0 => 195162)
--- trunk/LayoutTests/http/tests/loading/resources/server-redirect.php (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resources/server-redirect.php 2016-01-16 02:08:08 UTC (rev 195162)
@@ -0,0 +1,4 @@
+<?php
+header("Location: server-redirect-result.html", true, 301);
+exit();
+?>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching-expected.txt (0 => 195162)
--- trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching-expected.txt 2016-01-16 02:08:08 UTC (rev 195162)
@@ -0,0 +1,29 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/server-redirect.php, main document URL http://127.0.0.1:8000/loading/server-redirect-for-provisional-load-caching.html, http method GET> redirectResponse (null)
+main frame - didFinishDocumentLoadForFrame
+http://127.0.0.1:8000/loading/server-redirect-for-provisional-load-caching.html - didFinishLoading
+http://127.0.0.1:8000/loading/resources/server-redirect.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/server-redirect-result.html, main document URL http://127.0.0.1:8000/loading/server-redirect-for-provisional-load-caching.html, http method GET> redirectResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/server-redirect.php, http status code 301>
+frame "<!--framePath //<!--frame0-->-->" - didReceiveServerRedirectForProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/server-redirect-result.html, http status code 200>
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/server-redirect.php
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - didFinishLoading
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/server-redirect.php, main document URL http://127.0.0.1:8000/loading/server-redirect-for-provisional-load-caching.html, http method GET> redirectResponse (null)
+frame "<!--framePath //<!--frame0-->-->" - didReceiveServerRedirectForProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/server-redirect-result.html, http status code 200>
+frame "<!--framePath //<!--frame0-->-->" - didCancelClientRedirectForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+http://127.0.0.1:8000/loading/resources/server-redirect.php - didFinishLoading
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+Test passes if the second redirection which is loaded from the cache dispatches didReceiveServerRedirectForProvisionalLoadForFrame.
+
+
Added: trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching.html (0 => 195162)
--- trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/server-redirect-for-provisional-load-caching.html 2016-01-16 02:08:08 UTC (rev 195162)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+var count = 0;
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpResourceLoadCallbacks();
+ testRunner.waitUntilDone();
+}
+</script>
+</head>
+<p>Test passes if the second redirection which is loaded from the cache dispatches didReceiveServerRedirectForProvisionalLoadForFrame.</p>
+<iframe src=""
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (195161 => 195162)
--- trunk/Source/WebCore/ChangeLog 2016-01-16 01:55:03 UTC (rev 195161)
+++ trunk/Source/WebCore/ChangeLog 2016-01-16 02:08:08 UTC (rev 195162)
@@ -1,3 +1,20 @@
+2016-01-15 Jiewen Tan <[email protected]>
+
+ FrameLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame() is never called when loading a main resource from the memory cache
+ https://bugs.webkit.org/show_bug.cgi?id=152520
+ <rdar://problem/23305737>
+
+ Reviewed by Andy Estes.
+
+ Test: http/tests/loading/server-redirect-for-provisional-load-caching.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::responseReceived):
+ Dispatch message to notify client that a cached resource was redirected. So,
+ client can make proper actions to treat server side redirection.
+ * loader/cache/CachedRawResource.h:
+ Add a method to tell whether the cached resource was redirected.
+
2016-01-15 Chris Dumez <[email protected]>
Drop obsolete HTMLDocument.width / height attributes
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (195161 => 195162)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-01-16 01:55:03 UTC (rev 195161)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-01-16 02:08:08 UTC (rev 195162)
@@ -662,6 +662,10 @@
m_response = response;
if (m_identifierForLoadWithoutResourceLoader) {
+ if (m_mainResource && m_mainResource->wasRedirected()) {
+ ASSERT(m_mainResource->status() == CachedResource::Status::Cached);
+ frameLoader()->client().dispatchDidReceiveServerRedirectForProvisionalLoad();
+ }
addResponse(m_response);
frameLoader()->notifier().dispatchDidReceiveResponse(this, m_identifierForLoadWithoutResourceLoader, m_response, 0);
}
Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.h (195161 => 195162)
--- trunk/Source/WebCore/loader/cache/CachedRawResource.h 2016-01-16 01:55:03 UTC (rev 195161)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.h 2016-01-16 02:08:08 UTC (rev 195162)
@@ -48,6 +48,8 @@
bool canReuse(const ResourceRequest&) const;
+ bool wasRedirected() const { return !m_redirectChain.isEmpty(); };
+
private:
virtual void didAddClient(CachedResourceClient*) override;
virtual void addDataBuffer(SharedBuffer&) override;