Commit 85d5a175 authored by carlosgc@webkit.org's avatar carlosgc@webkit.org

FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main...

FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=112418

Source/WebCore:

Reviewed by Darin Adler.

When the main resource is loaded from the memory cache the
response is not added to the ResponseVector of the document
loader, so that when committing the provisional load the remaining
delegate messages are not called because the ResponseVector of the
document loader is empty. When the main resource is loaded from
the memory cache, there's no resource loader, and the client is
notified about the response received using
ResourceLoadNotifier::dispatchDidReceiveResponse() directly
instead of ResourceLoadNotifier::didReceiveResponse() which is the
one adding the response to the ResponseVector of the document
loader. So, the problem can be fixed by adding the response to the
ResponseVector before calling dispatchDidReceiveResponse() when
loading the main resource without a resource loade

Test: loader/go-back-cached-main-resource.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):

LayoutTests:

Patch by Manuel Rego Casasnovas <rego@igalia.com> on 2013-04-11
Reviewed by Darin Adler.

* loader/go-back-cached-main-resource-expected.txt: Added.
* loader/go-back-cached-main-resource.html: Added.
* loader/resources/first-page.html: Added.
* loader/resources/other-page.html: Added.
* platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt: Added.
* platform/wk2/loader/go-back-cached-main-resource-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9f0f6977
2013-04-11 Manuel Rego Casasnovas <rego@igalia.com>
FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=112418
Reviewed by Darin Adler.
* loader/go-back-cached-main-resource-expected.txt: Added.
* loader/go-back-cached-main-resource.html: Added.
* loader/resources/first-page.html: Added.
* loader/resources/other-page.html: Added.
* platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt: Added.
* platform/wk2/loader/go-back-cached-main-resource-expected.txt: Added.
2013-04-10 No'am Rosenthal <noam@webkit.org>
Allow direct compositing of background images
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL resources/first-page.html, http method GET> redirectResponse (null)
<unknown> - didFinishLoading
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL resources/other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
resources/other-page.html - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL resources/first-page.html, http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL resources/other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
resources/other-page.html - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL (null), http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
This test check the following situation:
First you navigate to a page (first-page.html).
Then you go to another page (other-page.html).
You repeat previous steps again (going to first-page.html and then to other-page.html).
Finally you click back.
The problem was that the resource load callbacks when going back to the cached main resource were not being called.
See bug #112418.
<html>
<head>
<title>Test resource load callbacks going back to a cached main resource</title>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpResourceLoadCallbacks();
testRunner.setCanOpenWindows();
testRunner.waitUntilDone();
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
}
// Window we will be controlling.
var target;
// Counter for visits to first page.
var firstPageVisits = 0;
window.addEventListener('message', function(event) {
if (event.data === 'first-page') {
firstPageVisits++;
if (firstPageVisits < 3)
target.postMessage('navigate-other-page', '*');
return;
}
if (event.data === 'other-page') {
switch (firstPageVisits) {
case 1:
target.postMessage('navigate-first-page', '*');
break;
case 2:
target.postMessage('navigate-back', '*');
// Wait a bit for resource load callbacks
setTimeout(function () {
target.close();
if (window.testRunner)
window.testRunner.notifyDone();
}, 200);
break;
}
return;
}
}, false);
function startTest() {
// Open the target window and we will start to exchange messages.
target = window.open('resources/first-page.html');
}
</script>
</head>
<body onload="startTest();">
<p>This test check the following situation:</p>
<ul>
<li>First you navigate to a page (first-page.html).</li>
<li>Then you go to another page (other-page.html).</li>
<li>You repeat previous steps again (going to first-page.html and then to other-page.html).</li>
<li>Finally you click back.</li>
</ul>
<p>The problem was that the resource load callbacks when going back to the cached main resource were not being called.</p>
<p>See <a href="https://bugs.webkit.org/show_bug.cgi?id=112418">bug #112418</a>.</p>
</body>
</html>
<html>
<head>
<script>
function registerListeners() {
// Notify opener.
opener.postMessage('first-page', '*');
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// Navigate to other page.
if (event.data === 'navigate-other-page') {
window.location = 'other-page.html';
return;
}
}, false);
}
</script>
</head>
<body onload="registerListeners();">
</body>
</html>
<html>
<head>
<script>
function registerListeners() {
// Notify opener.
opener.postMessage('other-page', '*');
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// Navigate first resource.
if (event.data === 'navigate-first-page') {
window.location = 'first-page.html';
return;
}
// Navigate back.
if (event.data === 'navigate-back') {
window.history.back();
return;
}
}, false);
}
</script>
</head>
<body onload="registerListeners();">
</body>
</html>
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
<unknown> - didFinishLoading
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
<unknown> - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
<unknown> - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
<unknown> - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
<unknown> - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL , http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
This test check the following situation:
First you navigate to a page (first-page.html).
Then you go to another page (other-page.html).
You repeat previous steps again (going to first-page.html and then to other-page.html).
Finally you click back.
The problem was that the resource load callbacks when going back to the cached main resource were not being called.
See bug #112418.
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
<unknown> - didFinishLoading
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
resources/other-page.html - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
resources/other-page.html - didFinishLoading
resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL , http method GET> redirectResponse (null)
resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
resources/first-page.html - didFinishLoading
This test check the following situation:
First you navigate to a page (first-page.html).
Then you go to another page (other-page.html).
You repeat previous steps again (going to first-page.html and then to other-page.html).
Finally you click back.
The problem was that the resource load callbacks when going back to the cached main resource were not being called.
See bug #112418.
2013-04-11 Carlos Garcia Campos <cgarcia@igalia.com>
FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=112418
Reviewed by Darin Adler.
When the main resource is loaded from the memory cache the
response is not added to the ResponseVector of the document
loader, so that when committing the provisional load the remaining
delegate messages are not called because the ResponseVector of the
document loader is empty. When the main resource is loaded from
the memory cache, there's no resource loader, and the client is
notified about the response received using
ResourceLoadNotifier::dispatchDidReceiveResponse() directly
instead of ResourceLoadNotifier::didReceiveResponse() which is the
one adding the response to the ResponseVector of the document
loader. So, the problem can be fixed by adding the response to the
ResponseVector before calling dispatchDidReceiveResponse() when
loading the main resource without a resource loade
Test: loader/go-back-cached-main-resource.html
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
2013-04-10 Alexey Proskuryakov <ap@apple.com>
Remove some includes of CachedImage.h
......@@ -607,8 +607,10 @@ void DocumentLoader::responseReceived(CachedResource* resource, const ResourceRe
m_response = response;
if (m_identifierForLoadWithoutResourceLoader)
if (m_identifierForLoadWithoutResourceLoader) {
addResponse(m_response);
frameLoader()->notifier()->dispatchDidReceiveResponse(this, m_identifierForLoadWithoutResourceLoader, m_response, 0);
}
ASSERT(!m_waitingForContentPolicy);
m_waitingForContentPolicy = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment