From d227fc870c7a697500a3c900c31baf05fb9a8524 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 18 Aug 2009 15:36:45 +0100 Subject: Merge WebKit r47420 --- WebCore/loader/FrameLoader.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'WebCore/loader/FrameLoader.cpp') diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 256c82d..dd584ca 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -89,6 +89,7 @@ #include "SecurityOrigin.h" #include "SegmentedString.h" #include "Settings.h" +#include "SharedWorkerRepository.h" #include "TextResourceDecoder.h" #include "WindowFeatures.h" #include "XMLHttpRequest.h" @@ -277,6 +278,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_isDisplayingInitialEmptyDocument(false) , m_committedFirstRealDocumentLoad(false) , m_didPerformFirstNavigation(false) + , m_loadingFromCachedPage(false) #ifndef NDEBUG , m_didDispatchDidCommitLoad(false) #endif @@ -929,9 +931,6 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->setDocument(document); - if (dispatch) - dispatchWindowObjectAvailable(); - document->setURL(m_URL); if (m_decoder) document->setDecoder(m_decoder.get()); @@ -941,6 +940,9 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->domWindow()->setURL(document->url()); m_frame->domWindow()->setSecurityOrigin(document->securityOrigin()); + if (dispatch) + dispatchWindowObjectAvailable(); + updateFirstPartyForCookies(); Settings* settings = document->settings(); @@ -1843,6 +1845,9 @@ bool FrameLoader::canCachePageContainingThisFrame() #if ENABLE(DATABASE) && !m_frame->document()->hasOpenDatabases() #endif +#if ENABLE(SHARED_WORKERS) + && !SharedWorkerRepository::hasSharedWorkers(m_frame->document()) +#endif && !m_frame->document()->usingGeolocation() && m_currentHistoryItem && !m_quickRedirectComing @@ -1989,6 +1994,10 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel) if (m_frame->document()->hasOpenDatabases()) { PCLOG(" -Frame has open database handles"); cannotCache = true; } #endif +#if ENABLE(SHARED_WORKERS) + if (SharedWorkerRepository::hasSharedWorkers(m_frame->document())) + { PCLOG(" -Frame has associated SharedWorkers"); cannotCache = true; } +#endif if (m_frame->document()->usingGeolocation()) { PCLOG(" -Frame uses Geolocation"); cannotCache = true; } if (!m_currentHistoryItem) @@ -2833,7 +2842,8 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr prpCachedPage) RefPtr cachedPage = prpCachedPage; RefPtr pdl = m_provisionalDocumentLoader; - LOG(Loading, "WebCoreLoading %s: About to commit provisional load from previous URL %s", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data()); + LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from previous URL '%s' to new URL '%s'", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data(), + pdl ? pdl->url().string().utf8().data() : ""); // Check to see if we need to cache the page we are navigating away from into the back/forward cache. // We are doing this here because we know for sure that a new page is about to be loaded. @@ -2874,7 +2884,7 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr prpCachedPage) if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect()) updateHistoryForClientRedirect(); - if (m_documentLoader->isLoadingFromCachedPage()) { + if (m_loadingFromCachedPage) { m_frame->document()->documentDidBecomeActive(); // Force a layout to update view size and thereby update scrollbars. @@ -3451,7 +3461,7 @@ void FrameLoader::continueLoadAfterWillSubmitForm(PolicyAction) if (activeDocLoader && activeDocLoader->isLoadingMainResource()) return; - m_provisionalDocumentLoader->setLoadingFromCachedPage(false); + m_loadingFromCachedPage = false; unsigned long identifier = 0; @@ -4236,7 +4246,17 @@ bool FrameLoader::loadProvisionalItemFromCachedPage() RefPtr cachedPage = pageCache()->get(m_provisionalHistoryItem.get()); if (!cachedPage || !cachedPage->document()) return false; - provisionalDocumentLoader()->loadFromCachedPage(cachedPage.release()); + + DocumentLoader *provisionalLoader = provisionalDocumentLoader(); + LOG(PageCache, "WebCorePageCache: FrameLoader %p loading provisional DocumentLoader %p with URL '%s' from CachedPage %p", this, provisionalLoader, provisionalLoader->url().string().utf8().data(), cachedPage.get()); + + provisionalLoader->prepareForLoadStart(); + + m_loadingFromCachedPage = true; + + provisionalLoader->setCommitted(true); + commitProvisionalLoad(cachedPage); + return true; } @@ -5111,8 +5131,6 @@ void FrameLoader::dispatchWindowObjectAvailable() m_client->windowObjectCleared(); if (Page* page = m_frame->page()) { - if (InspectorController* inspector = page->inspectorController()) - inspector->inspectedWindowScriptObjectCleared(m_frame); if (InspectorController* inspector = page->parentInspectorController()) inspector->windowScriptObjectAvailable(); } -- cgit v1.1