void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) { LOG(History, "HistoryController %p updateForStandardLoad: Updating History for standard load in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader()->url().string().ascii().data()); FrameLoader& frameLoader = m_frame.loader(); bool needPrivacy = m_frame.page()->usesEphemeralSession(); const URL& historyURL = frameLoader.documentLoader()->urlForHistory(); if (!frameLoader.documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { if (updateType != UpdateAllExceptBackForwardList) updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader.client().updateGlobalHistory(); frameLoader.documentLoader()->setDidCreateGlobalHistoryEntry(true); if (frameLoader.documentLoader()->unreachableURL().isEmpty()) frameLoader.client().updateGlobalHistoryRedirectLinks(); } m_frame.loader().client().updateGlobalHistoryItemForPage(); } } else { // The client redirect replaces the current history item. updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame.page()) addVisitedLink(*page, historyURL); if (!frameLoader.documentLoader()->didCreateGlobalHistoryEntry() && frameLoader.documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty()) frameLoader.client().updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateForStandardLoad() { LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); FrameLoader* frameLoader = m_frame->loader(); Settings* settings = m_frame->settings(); bool needPrivacy = !settings || settings->privateBrowsingEnabled(); const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); if (!frameLoader->documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader->client()->updateGlobalHistory(); frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); if (frameLoader->documentLoader()->unreachableURL().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); } } else if (frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { m_currentItem->setURL(frameLoader->documentLoader()->url()); m_currentItem->setFormInfoFromRequest(frameLoader->documentLoader()->request()); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) page->group().addVisitedLink(historyURL); if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !frameLoader->url().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } }
// There are 2 things you might think of as "history", all of which are handled by these functions. // // 1) Back/forward: The m_currentItem is part of this mechanism. // 2) Global history: Handled by the client. // void HistoryController::updateForStandardLoad() { LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); if (!m_frame->loader()->documentLoader()->urlForHistory().isEmpty()) updateBackForwardListClippedAtTarget(true); }
void HistoryController::updateBackForwardListForFragmentScroll() { updateBackForwardListClippedAtTarget(false); // Since the document isn't changed as a result of a fragment scroll, we should // preserve the DocumentSequenceNumber of the previous item. if (!m_previousItem) return; ASSERT(m_currentItem); m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); }
void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->document()->title().utf8().data()); #endif if (!m_currentItem && !m_frame->tree()->parent()) { if (!m_frame->loader()->documentLoader()->urlForHistory().isEmpty()) updateBackForwardListClippedAtTarget(true); } // The client redirect replaces the current history item. updateCurrentItem(); }
void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); #endif Settings* settings = m_frame->settings(); bool needPrivacy = !settings || settings->privateBrowsingEnabled(); const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); if (m_frame->loader()->documentLoader()->isClientRedirect()) { if (!m_currentItem && !m_frame->tree()->parent()) { if (!historyURL.isEmpty()) { updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { m_frame->loader()->client()->updateGlobalHistory(); m_frame->loader()->documentLoader()->setDidCreateGlobalHistoryEntry(true); if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); } if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem()); } } if (m_currentItem) { m_currentItem->setURL(m_frame->loader()->documentLoader()->url()); m_currentItem->setFormInfoFromRequest(m_frame->loader()->documentLoader()->request()); } } else { Frame* parentFrame = m_frame->tree()->parent(); if (parentFrame && parentFrame->loader()->history()->m_currentItem) parentFrame->loader()->history()->m_currentItem->setChildItem(createItem(true)); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) addVisitedLink(page, historyURL); if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->loader()->url().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED if (m_frame.loader().documentLoader()) LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame.loader().documentLoader()->title().string().utf8().data()); #endif bool needPrivacy = m_frame.page()->usesEphemeralSession(); const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory(); if (m_frame.loader().documentLoader()->isClientRedirect()) { if (!m_currentItem && !m_frame.tree().parent()) { if (!historyURL.isEmpty()) { updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { m_frame.loader().client().updateGlobalHistory(); m_frame.loader().documentLoader()->setDidCreateGlobalHistoryEntry(true); if (m_frame.loader().documentLoader()->unreachableURL().isEmpty()) m_frame.loader().client().updateGlobalHistoryRedirectLinks(); } m_frame.loader().client().updateGlobalHistoryItemForPage(); } } // The client redirect replaces the current history item. updateCurrentItem(); } else { Frame* parentFrame = m_frame.tree().parent(); if (parentFrame && parentFrame->loader().history().currentItem()) parentFrame->loader().history().currentItem()->setChildItem(createItem()); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame.page()) addVisitedLink(*page, historyURL); if (!m_frame.loader().documentLoader()->didCreateGlobalHistoryEntry() && m_frame.loader().documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty()) m_frame.loader().client().updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) { LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); FrameLoader* frameLoader = m_frame->loader(); Settings* settings = m_frame->settings(); bool needPrivacy = !settings || settings->privateBrowsingEnabled(); const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); if (!frameLoader->documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { if (updateType != UpdateAllExceptBackForwardList) updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader->client()->updateGlobalHistory(); frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); if (frameLoader->documentLoader()->unreachableURL().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } m_frame->loader()->client()->updateGlobalHistoryItemForPage(); } } else { // The client redirect replaces the current history item. updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) addVisitedLink(page, historyURL); if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !m_frame->document()->url().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateBackForwardListForFragmentScroll() { updateBackForwardListClippedAtTarget(false); }