From 2c7369cf1b19c1256778335ec69ab271d6e87f14 Mon Sep 17 00:00:00 2001 From: "aroben@apple.com" Date: Fri, 27 Mar 2009 18:37:16 +0000 Subject: [PATCH 1/1] Don't include substitute data URLs in global history redirect chains WebCore: Don't include substitute data URLs in global history redirect chains Reviewed by Darin Adler. This might be testable if: - support were added to DRT for providing substitute data on failed loads - support were added to DRT for dumping redirect chains I tried doing the above and was still unable to make a test. * loader/FrameLoader.cpp: (WebCore::FrameLoader::updateHistoryForStandardLoad): (WebCore::FrameLoader::updateHistoryForRedirectWithLockedBackForwardList): Call updateGlobalHistoryRedirectLinks only if the load succeeded (i.e., there is no unreachableURL). Previous the FrameLoaderClient implementations were unconditionally calling updateGlobalHistoryRedirectLinks from within updateGlobalHistory. WebKit/mac: Don't include substitute data URLs in global history redirect chains Reviewed by Darin Adler. * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): Don't call updateGlobalHistoryRedirectLinks. FrameLoader calls this for us now. (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Added an assertion to help catch cases where we might be adding a substitute data URL into a redirect chain. WebKit/win: Don't include substitute data URLs in global history redirect chains Reviewed by Darin Adler. * WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::updateGlobalHistory): Don't call updateGlobalHistoryRedirectLinks. FrameLoader calls this for us now. (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Added an assertion to help catch cases where we might be adding a substitute data URL into a redirect chain. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42046 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 23 ++++++++++++++++++++++ WebCore/loader/FrameLoader.cpp | 4 ++++ WebKit/mac/ChangeLog | 15 ++++++++++++++ WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm | 3 +-- WebKit/win/ChangeLog | 15 ++++++++++++++ WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp | 2 +- 6 files changed, 59 insertions(+), 3 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 67c6d1e..d1633ab 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,26 @@ +2009-03-27 Adam Roben + + Don't include substitute data URLs in global history redirect chains + + + + Reviewed by Darin Adler. + + This might be testable if: + - support were added to DRT for providing substitute data on failed + loads + - support were added to DRT for dumping redirect chains + + I tried doing the above and was still unable to make a test. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::updateHistoryForStandardLoad): + (WebCore::FrameLoader::updateHistoryForRedirectWithLockedBackForwardList): + Call updateGlobalHistoryRedirectLinks only if the load succeeded + (i.e., there is no unreachableURL). Previous the FrameLoaderClient + implementations were unconditionally calling + updateGlobalHistoryRedirectLinks from within updateGlobalHistory. + 2009-03-27 Peter Kasting Reviewed by Eric Seidel. diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index edd04b0..8eb69fb 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -4724,6 +4724,8 @@ void FrameLoader::updateHistoryForStandardLoad() if (!needPrivacy) { m_client->updateGlobalHistory(); m_documentLoader->setDidCreateGlobalHistoryEntry(true); + if (m_documentLoader->unreachableURL().isEmpty()) + m_client->updateGlobalHistoryRedirectLinks(); } if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); @@ -4814,6 +4816,8 @@ void FrameLoader::updateHistoryForRedirectWithLockedBackForwardList() if (!needPrivacy) { m_client->updateGlobalHistory(); m_documentLoader->setDidCreateGlobalHistoryEntry(true); + if (m_documentLoader->unreachableURL().isEmpty()) + m_client->updateGlobalHistoryRedirectLinks(); } if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 985dd5f..36efa69 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,18 @@ +2009-03-27 Adam Roben + + Don't include substitute data URLs in global history redirect chains + + + + Reviewed by Darin Adler. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::updateGlobalHistory): Don't call + updateGlobalHistoryRedirectLinks. FrameLoader calls this for us now. + (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): + Added an assertion to help catch cases where we might be adding a + substitute data URL into a redirect chain. + 2009-03-27 Darin Adler Reviewed by Adam Roben. diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 95ac174..76c69f6 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -792,13 +792,12 @@ void WebFrameLoaderClient::updateGlobalHistory() withTitle:loader->title() method:loader->originalRequestCopy().httpMethod() wasFailure:loader->urlForHistoryReflectsFailure()]; - - updateGlobalHistoryRedirectLinks(); } void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() { DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader(); + ASSERT(loader->unreachableURL().isEmpty()); if (!loader->clientRedirectSourceForHistory().isNull()) { if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()]) diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 5f89f66..2eb4c28 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,18 @@ +2009-03-27 Adam Roben + + Don't include substitute data URLs in global history redirect chains + + + + Reviewed by Darin Adler. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): Don't call + updateGlobalHistoryRedirectLinks. FrameLoader calls this for us now. + (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): + Added an assertion to help catch cases where we might be adding a + substitute data URL into a redirect chain. + 2009-03-26 Dan Bernstein Reviewed by Adam Roben. diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index c307660..68157f4 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -482,7 +482,6 @@ void WebFrameLoaderClient::updateGlobalHistory() DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); history->visitedURL(loader->urlForHistory(), loader->title(), loader->originalRequestCopy().httpMethod(), loader->urlForHistoryReflectsFailure()); - updateGlobalHistoryRedirectLinks(); } void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() @@ -492,6 +491,7 @@ void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() return; DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); + ASSERT(loader->unreachableURL().isEmpty()); if (!loader->clientRedirectSourceForHistory().isNull()) { if (COMPtr iWebHistoryItem = history->itemForURLString(loader->clientRedirectSourceForHistory())) { -- 1.8.3.1