http://trac.webkit.org/changeset/113526
https://bugs.webkit.org/show_bug.cgi?id=83417
speculative rollout for broken chrome browser_test (Requested
by simonjam on #webkit).
Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-04-06
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoading):
(WebCore::DocumentLoader::finishedLoading):
(WebCore::DocumentLoader::setupForReplaceByMIMEType):
(WebCore):
(WebCore::DocumentLoader::setParsedArchiveData):
(WebCore::DocumentLoader::scheduleArchiveLoad):
(WebCore::DocumentLoader::documentURL):
* loader/DocumentLoader.h:
(DocumentLoader):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::loadArchive):
(WebCore::FrameLoader::stopAllLoaders):
(WebCore::FrameLoader::finishedLoadingDocument):
(WebCore):
* loader/FrameLoader.h:
(FrameLoader):
(WebCore::FrameLoader::archive):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113539
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-06 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113526.
+ http://trac.webkit.org/changeset/113526
+ https://bugs.webkit.org/show_bug.cgi?id=83417
+
+ speculative rollout for broken chrome browser_test (Requested
+ by simonjam on #webkit).
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::stopLoading):
+ (WebCore::DocumentLoader::finishedLoading):
+ (WebCore::DocumentLoader::setupForReplaceByMIMEType):
+ (WebCore):
+ (WebCore::DocumentLoader::setParsedArchiveData):
+ (WebCore::DocumentLoader::scheduleArchiveLoad):
+ (WebCore::DocumentLoader::documentURL):
+ * loader/DocumentLoader.h:
+ (DocumentLoader):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::receivedFirstData):
+ (WebCore::FrameLoader::loadArchive):
+ (WebCore::FrameLoader::stopAllLoaders):
+ (WebCore::FrameLoader::finishedLoadingDocument):
+ (WebCore):
+ * loader/FrameLoader.h:
+ (FrameLoader):
+ (WebCore::FrameLoader::archive):
+
2012-04-06 James Robinson <jamesr@chromium.org>
[chromium] Avoid deleting impl tree when becoming invisible
// Appcache uses ResourceHandle directly, DocumentLoader doesn't count these loads.
m_applicationCacheHost->stopLoadingInFrame(m_frame);
-
-#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
- clearArchiveResources();
-#endif
if (!loading) {
// If something above restarted loading we might run into mysterious crashes like
{
m_gotFirstByte = true;
commitIfReady();
- if (!frameLoader() || frameLoader()->stateMachine()->creatingInitialEmptyDocument())
+ if (!frameLoader())
return;
- if (!maybeCreateArchive())
- frameLoader()->client()->finishedLoading(this);
+ frameLoader()->finishedLoadingDocument(this);
m_writer.end();
- if (!m_mainDocumentError.isNull())
+ if (!m_mainDocumentError.isNull() || frameLoader()->stateMachine()->creatingInitialEmptyDocument())
return;
clearMainResourceLoader();
frameLoader()->checkLoadComplete();
commitLoad(resourceData->data(), resourceData->size());
}
- maybeCreateArchive();
+ frameLoader()->finishedLoadingDocument(this);
m_writer.end();
frameLoader()->setReplacing();
return frameLoader()->subframeIsLoading();
}
-bool DocumentLoader::maybeCreateArchive()
-{
-#if !ENABLE(WEB_ARCHIVE) && !ENABLE(MHTML)
- return false;
-#else
-
- // Give the archive machinery a crack at this document. If the MIME type is not an archive type, it will return 0.
- m_archive = ArchiveFactory::create(m_response.url(), mainResourceData().get(), m_response.mimeType());
- if (!m_archive)
- return false;
-
- addAllArchiveResources(m_archive.get());
- ArchiveResource* mainResource = m_archive->mainResource();
- m_parsedArchiveData = mainResource->data();
- m_writer.setMIMEType(mainResource->mimeType());
-
- ASSERT(m_frame->document());
- String userChosenEncoding = overrideEncoding();
- bool encodingIsUserChosen = !userChosenEncoding.isNull();
- m_writer.setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
-
-#if ENABLE(MHTML)
- // The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
- // relative URLs are resolved properly.
- if (m_archive->type() == Archive::MHTML)
- m_frame->document()->setBaseURLOverride(mainResource->url());
-#endif
-
- m_writer.addData(mainResource->data()->data(), mainResource->data()->size());
- return true;
-#endif // !ENABLE(WEB_ARCHIVE) && !ENABLE(MHTML)
-}
-
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
-void DocumentLoader::setArchive(PassRefPtr<Archive> archive)
-{
- m_archive = archive;
- addAllArchiveResources(m_archive.get());
-}
-
void DocumentLoader::addAllArchiveResources(Archive* archive)
{
if (!m_archiveResourceCollection)
m_substituteResourceDeliveryTimer.stop();
}
+void DocumentLoader::setParsedArchiveData(PassRefPtr<SharedBuffer> data)
+{
+ m_parsedArchiveData = data;
+}
+
SharedBuffer* DocumentLoader::parsedArchiveData() const
{
return m_parsedArchiveData.get();
}
}
- if (!m_archive)
+ Archive* archive = frameLoader()->archive();
+ if (!archive)
return false;
- switch (m_archive->type()) {
+ switch (archive->type()) {
#if ENABLE(WEB_ARCHIVE)
case Archive::WebArchive:
// WebArchiveDebugMode means we fail loads instead of trying to fetch them from the network if they're not in the archive.
KURL DocumentLoader::documentURL() const
{
KURL url = substituteData().responseURL();
-#if ENABLE(WEB_ARCHIVE)
- if (url.isEmpty() && m_archive && m_archive->type() == Archive::WebArchive)
- url = m_archive->mainResource()->url();
-#endif
if (url.isEmpty())
url = requestURL();
if (url.isEmpty())
#endif
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
- void setArchive(PassRefPtr<Archive>);
void addAllArchiveResources(Archive*);
void addArchiveResource(PassRefPtr<ArchiveResource>);
+
PassRefPtr<Archive> popArchiveForSubframe(const String& frameName, const KURL&);
+ void clearArchiveResources();
+ void setParsedArchiveData(PassRefPtr<SharedBuffer>);
SharedBuffer* parsedArchiveData() const;
-
+
bool scheduleArchiveLoad(ResourceLoader*, const ResourceRequest&, const KURL&);
#endif // ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
bool doesProgressiveLoad(const String& MIMEType) const;
void checkLoadComplete();
void clearMainResourceLoader();
-
- bool maybeCreateArchive();
-#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
- void clearArchiveResources();
-#endif
void deliverSubstituteResourcesAfterDelay();
void substituteResourceDeliveryTimerFired(Timer<DocumentLoader>*);
OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
- RefPtr<Archive> m_archive;
RefPtr<SharedBuffer> m_parsedArchiveData;
#endif
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
#include "Archive.h"
+#include "ArchiveFactory.h"
#endif
namespace WebCore {
void FrameLoader::receivedFirstData()
{
KURL workingURL = activeDocumentLoader()->documentURL();
+#if ENABLE(WEB_ARCHIVE)
+ // FIXME: The document loader, not the frame loader, should be in charge of loading web archives.
+ // Once this is done, we can just make DocumentLoader::documentURL() return the right URL
+ // based on whether it has a non-null archive or not.
+ if (m_archive && activeDocumentLoader()->parsedArchiveData())
+ workingURL = m_archive->mainResource()->url();
+#endif
+
activeDocumentLoader()->writer()->begin(workingURL, false);
activeDocumentLoader()->writer()->setDocumentWasLoadedAsPartOfNavigation();
+#if ENABLE(MHTML)
+ if (m_archive) {
+ // The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
+ // relative URLs are resolved properly.
+ m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url());
+ }
+#endif
+
dispatchDidCommitLoad();
dispatchDidClearWindowObjectsInAllWorlds();
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
void FrameLoader::loadArchive(PassRefPtr<Archive> archive)
{
- ArchiveResource* mainResource = archive->mainResource();
+ m_archive = archive;
+
+ ArchiveResource* mainResource = m_archive->mainResource();
ASSERT(mainResource);
if (!mainResource)
return;
#endif
RefPtr<DocumentLoader> documentLoader = m_client->createDocumentLoader(request, substituteData);
- documentLoader->setArchive(archive.get());
+ documentLoader->addAllArchiveResources(m_archive.get());
load(documentLoader.get());
}
#endif // ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
m_documentLoader->stopLoading();
setProvisionalDocumentLoader(0);
+
+#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
+ if (m_documentLoader)
+ m_documentLoader->clearArchiveResources();
+#endif
m_checkTimer.stop();
return page && m_frame == page->mainFrame();
}
+void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
+{
+ if (m_stateMachine.creatingInitialEmptyDocument())
+ return;
+
+#if !ENABLE(WEB_ARCHIVE) && !ENABLE(MHTML)
+ m_client->finishedLoading(loader);
+#else
+ // Give archive machinery a crack at this document. If the MIME type is not an archive type, it will return 0.
+ m_archive = ArchiveFactory::create(loader->response().url(), loader->mainResourceData().get(), loader->responseMIMEType());
+ if (!m_archive) {
+ m_client->finishedLoading(loader);
+ return;
+ }
+
+ // FIXME: The remainder of this function should be moved to DocumentLoader.
+
+ loader->addAllArchiveResources(m_archive.get());
+
+ ArchiveResource* mainResource = m_archive->mainResource();
+ loader->setParsedArchiveData(mainResource->data());
+
+ loader->writer()->setMIMEType(mainResource->mimeType());
+
+ closeURL();
+ didOpenURL();
+
+ ASSERT(m_frame->document());
+ String userChosenEncoding = documentLoader()->overrideEncoding();
+ bool encodingIsUserChosen = !userChosenEncoding.isNull();
+ loader->writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
+ loader->writer()->addData(mainResource->data()->data(), mainResource->data()->size());
+#endif // ENABLE(WEB_ARCHIVE)
+}
+
bool FrameLoader::isReplacing() const
{
return m_loadType == FrameLoadTypeReplace;
bool isHostedByObjectElement() const;
bool isLoadingMainFrame() const;
+ void finishedLoadingDocument(DocumentLoader*);
bool isReplacing() const;
void setReplacing();
bool subframeIsLoading() const;
NetworkingContext* networkingContext() const;
+#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
+ Archive* archive() const { return m_archive.get(); }
+#endif
+
private:
bool allChildrenAreComplete() const; // immediate children, not all descendants
RefPtr<FrameNetworkingContext> m_networkingContext;
+#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
+ RefPtr<Archive> m_archive;
+#endif
+
KURL m_previousUrl;
RefPtr<HistoryItem> m_requestedHistoryItem;
};