Source/WebCore: Loader cleanup : Simplify FrameLoader/DocumentLoader setupForReplace()
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Oct 2012 17:08:38 +0000 (17:08 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Oct 2012 17:08:38 +0000 (17:08 +0000)
commit43fc06ada338f12d6ed4f7afad9f450fb17cd027
tree0e3dc10098629514b924819ebb5ff8e05c7bba92
parentd1d95ea1338d6fef7ac316a4c9470fea35a6dd48
Source/WebCore: Loader cleanup : Simplify FrameLoader/DocumentLoader setupForReplace()
https://bugs.webkit.org/show_bug.cgi?id=49072

Reviewed by Eric Seidel.

This patch contains one small known behavior change: multipart/x-mixed-replace main resources with text/html parts
will no longer load the text/html progressively. In practice, loading the html progressively causes the document
to get cleared as soon as the next part's data starts arriving, which leads to a blank page most of the time. This case
seems to be pathological, as IE, FF, Opera and WebKit all do something different currently. This patch will cause
us to behave like Firefox, which is the most sane of the current behaviors.

Test: http/tests/multipart/multipart-html.php

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::commitData): Use isMultipartReplacingLoad() helper.
(WebCore::DocumentLoader::receivedData):
(WebCore::DocumentLoader::setupForReplace): Renamed from setupForReplaceByMIMEType(). Call maybeFinishLoadingMultipartContent()
    instead of doing identical work inline. After we call frameLoader()->setReplacing(), we will never load progressively, so remove
    the if (doesProgressiveLoad(newMIMEType)) {} block.
(WebCore::DocumentLoader::isMultipartReplacingLoad):
(WebCore::DocumentLoader::maybeFinishLoadingMultipartContent): Inline the old DocumentLoader::setupForeReplace(), check
    frameLoader()->isReplacing() instead of the delete doesProgressiveLoad().
* loader/DocumentLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::setupForReplace): Move all calls to revertToProvisionalState here.
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::didReceiveResponse): Call setupForReplace(), renamed from setupForReplaceByMIMEType().

LayoutTests: Add a test for multipart/x-mixed-replace documents with text/html
parts.
https://bugs.webkit.org/show_bug.cgi?id=49072

Reviewed by Eric Seidel.

* http/tests/multipart/multipart-html-expected.txt: Added.
* http/tests/multipart/multipart-html.php: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/multipart/multipart-html-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/multipart/multipart-html.php [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/MainResourceLoader.cpp