| Index: Source/core/loader/FrameLoader.cpp
|
| diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
|
| index 83dd3d5d01526e6f375843bf3b12b3b288c5fa75..02db52ada53fd5865ba4b9ba01e308c4153b2301 100644
|
| --- a/Source/core/loader/FrameLoader.cpp
|
| +++ b/Source/core/loader/FrameLoader.cpp
|
| @@ -70,6 +70,7 @@
|
| #include "core/frame/ContentSecurityPolicy.h"
|
| #include "core/frame/ContentSecurityPolicyResponseHeaders.h"
|
| #include "core/frame/DOMWindow.h"
|
| +#include "core/page/BackForwardClient.h"
|
| #include "core/page/EventHandler.h"
|
| #include "core/frame/Frame.h"
|
| #include "core/page/FrameTree.h"
|
| @@ -153,7 +154,7 @@ private:
|
| FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
|
| : m_frame(frame)
|
| , m_client(client)
|
| - , m_history(frame)
|
| + , m_history(frame->page()->history())
|
| , m_icon(adoptPtr(new IconController(frame)))
|
| , m_fetchContext(FrameFetchContext::create(frame))
|
| , m_mixedContentChecker(frame)
|
| @@ -235,7 +236,7 @@ void FrameLoader::stopLoading()
|
|
|
| bool FrameLoader::closeURL()
|
| {
|
| - history()->saveDocumentAndScrollState();
|
| + history()->saveDocumentAndScrollState(m_frame);
|
|
|
| // Should only send the pagehide event here if the current document exists.
|
| if (m_frame->document())
|
| @@ -328,8 +329,8 @@ void FrameLoader::didBeginDocument(bool dispatch)
|
| m_isComplete = false;
|
| m_frame->document()->setReadyState(Document::Loading);
|
|
|
| - if (history()->currentItem() && m_loadType == FrameLoadTypeBackForward)
|
| - m_frame->document()->statePopped(history()->currentItem()->stateObject());
|
| + if (history()->currentItem(m_frame) && m_loadType == FrameLoadTypeBackForward)
|
| + m_frame->document()->statePopped(history()->currentItem(m_frame)->stateObject());
|
|
|
| if (dispatch)
|
| dispatchDidClearWindowObjectsInAllWorlds();
|
| @@ -357,7 +358,7 @@ void FrameLoader::didBeginDocument(bool dispatch)
|
| }
|
| }
|
|
|
| - history()->restoreDocumentState();
|
| + history()->restoreDocumentState(m_frame);
|
| }
|
|
|
| void FrameLoader::finishedParsing()
|
| @@ -537,14 +538,14 @@ void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume
|
| // replaceRequestURLForSameDocumentNavigation(), since we add based on
|
| // the current request.
|
| if (updateBackForwardList == UpdateBackForwardList)
|
| - history()->updateBackForwardListForFragmentScroll();
|
| + history()->updateBackForwardListForFragmentScroll(m_frame);
|
|
|
| if (sameDocumentNavigationSource == SameDocumentNavigationDefault)
|
| - history()->updateForSameDocumentNavigation();
|
| + history()->updateForSameDocumentNavigation(m_frame);
|
| else if (sameDocumentNavigationSource == SameDocumentNavigationPushState)
|
| - history()->pushState(data, newURL.string());
|
| + history()->pushState(m_frame, data, newURL.string());
|
| else if (sameDocumentNavigationSource == SameDocumentNavigationReplaceState)
|
| - history()->replaceState(data, newURL.string());
|
| + history()->replaceState(m_frame, data, newURL.string());
|
| else
|
| ASSERT_NOT_REACHED();
|
|
|
| @@ -622,16 +623,6 @@ void FrameLoader::started()
|
|
|
| void FrameLoader::prepareForHistoryNavigation()
|
| {
|
| - // If there is no currentItem, but we still want to engage in
|
| - // history navigation we need to manufacture one, and update
|
| - // the state machine of this frame to impersonate having
|
| - // loaded it.
|
| - RefPtr<HistoryItem> currentItem = history()->currentItem();
|
| - if (!currentItem) {
|
| - insertDummyHistoryItem();
|
| - ASSERT(stateMachine()->isDisplayingInitialEmptyDocument());
|
| - stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
|
| - }
|
| }
|
|
|
| void FrameLoader::setReferrerForFrameRequest(ResourceRequest& request, ShouldSendReferrer shouldSendReferrer)
|
| @@ -665,7 +656,7 @@ FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
|
| {
|
| if (m_frame->tree()->parent() && !m_stateMachine.startedFirstRealLoad())
|
| return FrameLoadTypeInitialInChildFrame;
|
| - if (!m_frame->tree()->parent() && !history()->currentItem())
|
| + if (!m_frame->tree()->parent() && !m_frame->page()->backForward().backForwardListCount())
|
| return FrameLoadTypeStandard;
|
| if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
|
| return FrameLoadTypeReload;
|
| @@ -786,9 +777,6 @@ void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
|
| if (!documentLoader)
|
| return;
|
|
|
| - if (m_state == FrameStateProvisional)
|
| - insertDummyHistoryItem();
|
| -
|
| ResourceRequest request = documentLoader->request();
|
| // FIXME: We need to reset cache policy to prevent it from being incorrectly propagted to the reload.
|
| // Do we need to propagate anything other than the url?
|
| @@ -907,7 +895,7 @@ void FrameLoader::commitProvisionalLoad()
|
| if (isLoadingMainFrame())
|
| m_frame->page()->chrome().client().needTouchEvents(false);
|
|
|
| - history()->updateForCommit();
|
| + history()->updateForCommit(m_frame);
|
| m_client->transitionToCommittedForNewPage();
|
|
|
| m_frame->navigationScheduler()->cancel();
|
| @@ -1023,7 +1011,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
|
| // If the user had a scroll point, scroll to it, overriding the anchor point if any.
|
| if (m_frame->page()) {
|
| if (isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin)
|
| - history()->restoreScrollPositionAndViewState();
|
| + history()->restoreScrollPositionAndViewState(m_frame);
|
| }
|
|
|
| if (!m_stateMachine.committedFirstRealDocumentLoad())
|
| @@ -1042,7 +1030,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
|
| void FrameLoader::didFirstLayout()
|
| {
|
| if (m_frame->page() && isBackForwardLoadType(m_loadType))
|
| - history()->restoreScrollPositionAndViewState();
|
| + history()->restoreScrollPositionAndViewState(m_frame);
|
| }
|
|
|
| void FrameLoader::detachChildren()
|
| @@ -1249,7 +1237,7 @@ void FrameLoader::checkNavigationPolicyAndContinueFragmentScroll(const Navigatio
|
| m_provisionalDocumentLoader->detachFromFrame();
|
| m_provisionalDocumentLoader = 0;
|
| }
|
| - history()->setProvisionalItem(0);
|
| + history()->clearProvisionalEntry();
|
| loadInSameDocument(request.url(), 0, isNewNavigation);
|
| }
|
|
|
| @@ -1488,9 +1476,7 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
|
|
|
| bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const
|
| {
|
| - if (!history()->currentItem())
|
| - return false;
|
| - return url == history()->currentItem()->url() || url == history()->currentItem()->originalURL();
|
| + return url == m_frame->document()->url() || url == m_documentLoader->originalURL();
|
| }
|
|
|
| bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const
|
| @@ -1536,16 +1522,13 @@ Frame* FrameLoader::findFrameForNavigation(const AtomicString& name, Document* a
|
|
|
| void FrameLoader::loadHistoryItem(HistoryItem* item)
|
| {
|
| - HistoryItem* currentItem = history()->currentItem();
|
| -
|
| - if (currentItem && item->shouldDoSameDocumentNavigationTo(currentItem)) {
|
| - history()->setCurrentItem(item);
|
| + if (shouldTreatURLAsSameAsCurrent(item->url())) {
|
| loadInSameDocument(item->url(), item->stateObject(), false);
|
| return;
|
| }
|
|
|
| - // Remember this item so we can traverse any child items as child frames load
|
| - history()->setProvisionalItem(item);
|
| + RefPtr<Frame> protect(m_frame);
|
| + m_frame->page()->mainFrame()->loader()->stopAllLoaders();
|
|
|
| RefPtr<FormData> formData = item->formData();
|
| ResourceRequest request(item->url());
|
| @@ -1563,8 +1546,6 @@ void FrameLoader::loadHistoryItem(HistoryItem* item)
|
|
|
| void FrameLoader::insertDummyHistoryItem()
|
| {
|
| - RefPtr<HistoryItem> currentItem = HistoryItem::create();
|
| - history()->setCurrentItem(currentItem.get());
|
| }
|
|
|
| void FrameLoader::dispatchDocumentElementAvailable()
|
|
|