Changeset 130651 in webkit
- Timestamp:
- Oct 8, 2012, 10:08:38 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/multipart/multipart-html-expected.txt (added)
-
LayoutTests/http/tests/multipart/multipart-html.php (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (5 diffs)
-
Source/WebCore/loader/DocumentLoader.h (modified) (3 diffs)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/MainResourceLoader.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r130650 r130651 1 2012-10-08 Nate Chapin <japhet@chromium.org> 2 3 Add a test for multipart/x-mixed-replace documents with text/html 4 parts. 5 https://bugs.webkit.org/show_bug.cgi?id=49072 6 7 Reviewed by Eric Seidel. 8 9 * http/tests/multipart/multipart-html-expected.txt: Added. 10 * http/tests/multipart/multipart-html.php: Added. 11 1 12 2012-10-08 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r130636 r130651 1 2012-10-08 Nate Chapin <japhet@chromium.org> 2 3 Loader cleanup : Simplify FrameLoader/DocumentLoader setupForReplace() 4 https://bugs.webkit.org/show_bug.cgi?id=49072 5 6 Reviewed by Eric Seidel. 7 8 This patch contains one small known behavior change: multipart/x-mixed-replace main resources with text/html parts 9 will no longer load the text/html progressively. In practice, loading the html progressively causes the document 10 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 11 seems to be pathological, as IE, FF, Opera and WebKit all do something different currently. This patch will cause 12 us to behave like Firefox, which is the most sane of the current behaviors. 13 14 Test: http/tests/multipart/multipart-html.php 15 16 * loader/DocumentLoader.cpp: 17 (WebCore::DocumentLoader::commitData): Use isMultipartReplacingLoad() helper. 18 (WebCore::DocumentLoader::receivedData): 19 (WebCore::DocumentLoader::setupForReplace): Renamed from setupForReplaceByMIMEType(). Call maybeFinishLoadingMultipartContent() 20 instead of doing identical work inline. After we call frameLoader()->setReplacing(), we will never load progressively, so remove 21 the if (doesProgressiveLoad(newMIMEType)) {} block. 22 (WebCore::DocumentLoader::isMultipartReplacingLoad): 23 (WebCore::DocumentLoader::maybeFinishLoadingMultipartContent): Inline the old DocumentLoader::setupForeReplace(), check 24 frameLoader()->isReplacing() instead of the delete doesProgressiveLoad(). 25 * loader/DocumentLoader.h: 26 * loader/FrameLoader.cpp: 27 (WebCore::FrameLoader::setupForReplace): Move all calls to revertToProvisionalState here. 28 * loader/MainResourceLoader.cpp: 29 (WebCore::MainResourceLoader::didReceiveResponse): Call setupForReplace(), renamed from setupForReplaceByMIMEType(). 30 1 31 2012-10-08 Zoltan Horvath <zoltan@webkit.org> 2 32 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r130612 r130651 273 273 } 274 274 275 void DocumentLoader::setupForReplace()276 {277 frameLoader()->setupForReplace();278 m_committed = false;279 }280 281 275 void DocumentLoader::commitIfReady() 282 276 { … … 341 335 342 336 // Call receivedFirstData() exactly once per load. We should only reach this point multiple times 343 // for multipart loads, and isReplacing() will be true after the first time.344 if (! m_mainResourceLoader || !m_mainResourceLoader->isLoadingMultipartContent() || !frameLoader()->isReplacing())337 // for multipart loads, and FrameLoader::isReplacing() will be true after the first time. 338 if (!isMultipartReplacingLoad()) 345 339 frameLoader()->receivedFirstData(); 346 340 … … 386 380 } 387 381 388 bool DocumentLoader::doesProgressiveLoad(const String& MIMEType) const389 {390 return !frameLoader()->isReplacing() || MIMEType == "text/html";391 }392 393 382 void DocumentLoader::receivedData(const char* data, int length) 394 383 { 395 if ( doesProgressiveLoad(m_response.mimeType()))384 if (!isMultipartReplacingLoad()) 396 385 commitLoad(data, length); 397 386 } 398 387 399 void DocumentLoader::setupForReplace ByMIMEType(const String& newMIMEType)388 void DocumentLoader::setupForReplace() 400 389 { 401 390 if (!mainResourceData()) 402 391 return; 403 392 404 String oldMIMEType = m_response.mimeType(); 405 406 if (!doesProgressiveLoad(oldMIMEType)) { 407 frameLoader()->client()->revertToProvisionalState(this); 408 setupForReplace(); 409 RefPtr<SharedBuffer> resourceData = mainResourceData(); 410 commitLoad(resourceData->data(), resourceData->size()); 411 } 412 393 maybeFinishLoadingMultipartContent(); 413 394 maybeCreateArchive(); 414 395 m_writer.end(); 415 416 396 frameLoader()->setReplacing(); 417 397 m_gotFirstByte = false; 418 419 if (doesProgressiveLoad(newMIMEType)) {420 frameLoader()->client()->revertToProvisionalState(this);421 setupForReplace();422 }423 398 424 399 stopLoadingSubresources(); … … 860 835 } 861 836 837 bool DocumentLoader::isMultipartReplacingLoad() const 838 { 839 return isLoadingMultipartContent() && frameLoader()->isReplacing(); 840 } 841 862 842 void DocumentLoader::startLoadingMainResource() 863 843 { … … 889 869 void DocumentLoader::maybeFinishLoadingMultipartContent() 890 870 { 891 if (!doesProgressiveLoad(m_response.mimeType())) { 892 frameLoader()->client()->revertToProvisionalState(this); 893 setupForReplace(); 894 RefPtr<SharedBuffer> resourceData = mainResourceData(); 895 commitLoad(resourceData->data(), resourceData->size()); 896 } 871 if (!frameLoader()->isReplacing()) 872 return; 873 874 frameLoader()->setupForReplace(); 875 m_committed = false; 876 RefPtr<SharedBuffer> resourceData = mainResourceData(); 877 commitLoad(resourceData->data(), resourceData->size()); 897 878 } 898 879 -
trunk/Source/WebCore/loader/DocumentLoader.h
r128418 r130651 113 113 bool isLoading() const { return isLoadingMainResource() || !m_subresourceLoaders.isEmpty() || !m_plugInStreamLoaders.isEmpty(); } 114 114 void receivedData(const char*, int); 115 void setupForReplace ByMIMEType(const String& newMIMEType);115 void setupForReplace(); 116 116 void finishedLoading(); 117 117 const ResourceResponse& response() const { return m_response; } … … 251 251 252 252 private: 253 void setupForReplace();254 253 void commitIfReady(); 255 254 void setMainDocumentError(const ResourceError&); 256 255 void commitLoad(const char*, int); 257 bool doesProgressiveLoad(const String& MIMEType) const;258 256 void checkLoadComplete(); 259 257 void clearMainResourceLoader(); … … 263 261 void clearArchiveResources(); 264 262 #endif 263 264 bool isMultipartReplacingLoad() const; 265 265 266 266 void deliverSubstituteResourcesAfterDelay(); -
trunk/Source/WebCore/loader/FrameLoader.cpp
r130313 r130651 1146 1146 void FrameLoader::setupForReplace() 1147 1147 { 1148 m_client->revertToProvisionalState(m_documentLoader.get()); 1148 1149 setState(FrameStateProvisional); 1149 1150 m_provisionalDocumentLoader = m_documentLoader; -
trunk/Source/WebCore/loader/MainResourceLoader.cpp
r130612 r130651 387 387 388 388 if (m_loadingMultipartContent) { 389 frameLoader()->activeDocumentLoader()->setupForReplaceByMIMEType(r.mimeType());389 m_documentLoader->setupForReplace(); 390 390 clearResourceData(); 391 391 }
Note:
See TracChangeset
for help on using the changeset viewer.