diff options
author | Feng Qian <> | 2009-04-10 18:11:29 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-10 18:11:29 -0700 |
commit | 8f72e70a9fd78eec56623b3a62e68f16b7b27e28 (patch) | |
tree | 181bf9a400c30a1bf34ea6d72560e8d00111d549 /WebCore/loader/MainResourceLoader.cpp | |
parent | 7ed56f225e0ade046e1c2178977f72b2d896f196 (diff) | |
download | external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.zip external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.gz external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.bz2 |
AI 145796: Land the WebKit merge @r42026.
Automated import of CL 145796
Diffstat (limited to 'WebCore/loader/MainResourceLoader.cpp')
-rw-r--r-- | WebCore/loader/MainResourceLoader.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp index 325809b..5aa1cde 100644 --- a/WebCore/loader/MainResourceLoader.cpp +++ b/WebCore/loader/MainResourceLoader.cpp @@ -186,7 +186,11 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso static bool shouldLoadAsEmptyDocument(const KURL& url) { - return url.isEmpty() || equalIgnoringCase(String(url.protocol()), "about"); +#if PLATFORM(TORCHMOBILE) + return url.isEmpty() || (url.protocolIs("about") && equalIgnoringRef(url, blankURL())); +#else + return url.isEmpty() || url.protocolIs("about"); +#endif } void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, const ResourceResponse& r) @@ -248,7 +252,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, if (!reachedTerminalState()) ResourceLoader::didReceiveResponse(r); - if (frameLoader() && !frameLoader()->isStopping()) + if (frameLoader() && !frameLoader()->isStopping()) { if (m_substituteData.isValid()) { if (m_substituteData.content()->size()) didReceiveData(m_substituteData.content()->data(), m_substituteData.content()->size(), m_substituteData.content()->size(), true); @@ -256,6 +260,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, didFinishLoading(); } else if (shouldLoadAsEmptyDocument(url) || frameLoader()->representationExistsForURLScheme(url.protocol())) didFinishLoading(); + } } void MainResourceLoader::callContinueAfterContentPolicy(void* argument, PolicyAction policy) @@ -319,6 +324,17 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long ASSERT(data); ASSERT(length != 0); + ASSERT(!m_response.isNull()); + +#if USE(CFNETWORK) || (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)) + // Workaround for <rdar://problem/6060782> + if (m_response.isNull()) { + m_response = ResourceResponse(KURL(), "text/html", 0, String(), String()); + if (DocumentLoader* documentLoader = frameLoader()->activeDocumentLoader()) + documentLoader->setResponse(m_response); + } +#endif + // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred. // See <rdar://problem/6304600> for more details. #if !PLATFORM(CF) @@ -396,7 +412,7 @@ void MainResourceLoader::handleEmptyLoad(const KURL& url, bool forURLScheme) didReceiveResponse(response); } -void MainResourceLoader::handleDataLoadNow(Timer<MainResourceLoader>*) +void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*) { RefPtr<MainResourceLoader> protect(this); @@ -408,12 +424,22 @@ void MainResourceLoader::handleDataLoadNow(Timer<MainResourceLoader>*) didReceiveResponse(response); } +void MainResourceLoader::startDataLoadTimer() +{ + m_dataLoadTimer.startOneShot(0); + +#if HAVE(RUNLOOP_TIMER) + if (SchedulePairHashSet* scheduledPairs = m_frame->page()->scheduledRunLoopPairs()) + m_dataLoadTimer.schedule(*scheduledPairs); +#endif +} + void MainResourceLoader::handleDataLoadSoon(ResourceRequest& r) { m_initialRequest = r; if (m_documentLoader->deferMainResourceDataLoad()) - m_dataLoadTimer.startOneShot(0); + startDataLoadTimer(); else handleDataLoadNow(0); } @@ -497,17 +523,16 @@ bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& su void MainResourceLoader::setDefersLoading(bool defers) { ResourceLoader::setDefersLoading(defers); - + if (defers) { if (m_dataLoadTimer.isActive()) m_dataLoadTimer.stop(); } else { if (m_initialRequest.isNull()) return; - - if (m_substituteData.isValid() && - m_documentLoader->deferMainResourceDataLoad()) - m_dataLoadTimer.startOneShot(0); + + if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad()) + startDataLoadTimer(); else { ResourceRequest r(m_initialRequest); m_initialRequest = ResourceRequest(); |