WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 01:51:20 +0000 (01:51 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 01:51:20 +0000 (01:51 +0000)
        Reviewed by Mitz.

        - fix regression test failures from the visited-link change

        * WebCore.base.exp: Export PageGroup::setShouldTrackVisitedLinks.
        * page/PageGroup.cpp:
        (WebCore::PageGroup::addVisitedLink): Do nothing and return early
        if shouldTrackVisitedLinks is false.
        (WebCore::PageGroup::removeVisitedLinks): Reset m_visitedLinksPopulated
        so the next time a link is queried this will be populated from history.
        (WebCore::PageGroup::setShouldTrackVisitedLinks): Added.
        * page/PageGroup.h: Added setShouldTrackVisitedLinks. This is global
        for now, but it would be better if it was per-page-group instead.

WebKit/mac:

        Reviewed by Mitz.

        - fix regression test failures from the visited-link change

        * History/WebHistory.mm:
        (+[WebHistory setOptionalSharedHistory:]): Call PageGroup::setShouldTrackVisitedLinks
        to turn off visited links if there is no history object. Also call
        removeAllVisitedLinks so we can start over from scratch with the new history.

WebKit/win:

        Reviewed by Mitz.

        - fix regression test failures and crashes from the visited-link change

        * WebCoreSupport/WebChromeClient.cpp:
        (WebChromeClient::populateVisitedLinks): Check for null before calling
        addVisitedLinksToPageGroup.
        * WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebFrameLoaderClient::updateGlobalHistory): Ditto.
        * WebHistory.cpp:
        (WebHistory::setOptionalSharedHistory): Call PageGroup::setShouldTrackVisitedLinks
        to turn off visited links if there is no history object. Also call
        removeAllVisitedLinks so we can start over from scratch with the new history.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30867 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/page/PageGroup.cpp
WebCore/page/PageGroup.h
WebKit/mac/ChangeLog
WebKit/mac/History/WebHistory.mm
WebKit/win/ChangeLog
WebKit/win/WebCoreSupport/WebChromeClient.cpp
WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
WebKit/win/WebHistory.cpp

index 0d06269fd63f1263086e86ac8993c50a24dbc177..d1c984812b16a8590e01a7f54865e2877e72d844 100644 (file)
@@ -1,3 +1,19 @@
+2008-03-06  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mitz.
+
+        - fix regression test failures from the visited-link change
+
+        * WebCore.base.exp: Export PageGroup::setShouldTrackVisitedLinks.
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::addVisitedLink): Do nothing and return early
+        if shouldTrackVisitedLinks is false.
+        (WebCore::PageGroup::removeVisitedLinks): Reset m_visitedLinksPopulated
+        so the next time a link is queried this will be populated from history.
+        (WebCore::PageGroup::setShouldTrackVisitedLinks): Added.
+        * page/PageGroup.h: Added setShouldTrackVisitedLinks. This is global
+        for now, but it would be better if it was per-page-group instead.
+
 2008-03-06  Adele Peterson  <adele@apple.com>
 
         Reviewed by Darin.
index 263727bc17e0fb0062e37bbf525a19a8322c2e3f..5c588c9f4da0706ea7fa44fc2c48cb9ecbb939b8 100644 (file)
@@ -565,6 +565,7 @@ __ZN7WebCore9PageCache11setCapacityEi
 __ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
 __ZN7WebCore9PageGroup14addVisitedLinkEPKtm
 __ZN7WebCore9PageGroup21removeAllVisitedLinksEv
+__ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
 __ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
 __ZN7WebCore9TimerBase4stopEv
 __ZN7WebCore9TimerBase5startEdd
index 3acc8503514b1b74ba058ff6ce9804c7e8693cb1..e4d9710d1788165293ddad76ad78240572b4e06a 100644 (file)
@@ -34,6 +34,8 @@ namespace WebCore {
 
 // --------
 
+static bool shouldTrackVisitedLinks;
+
 PageGroup::PageGroup(Page* page)
     : m_visitedLinksPopulated(false)
 {
@@ -236,18 +238,23 @@ bool PageGroup::isLinkVisited(Document* document, const AtomicString& attributeU
 
 void PageGroup::addVisitedLink(const KURL& url)
 {
+    if (!shouldTrackVisitedLinks)
+        return;
     ASSERT(!url.isEmpty());
     m_visitedLinkHashes.add(url.string().impl()->hash());
 }
 
 void PageGroup::addVisitedLink(const UChar* characters, size_t length)
 {
+    if (!shouldTrackVisitedLinks)
+        return;
     m_visitedLinkHashes.add(StringImpl::computeHash(characters, length));
 }
 
 void PageGroup::removeVisitedLinks()
 {
     m_visitedLinkHashes.clear();
+    m_visitedLinksPopulated = false;
 }
 
 void PageGroup::removeAllVisitedLinks()
@@ -255,4 +262,13 @@ void PageGroup::removeAllVisitedLinks()
     Page::removeAllVisitedLinks();
 }
 
+void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack)
+{
+    if (shouldTrackVisitedLinks == shouldTrack)
+        return;
+    shouldTrackVisitedLinks = shouldTrack;
+    if (!shouldTrackVisitedLinks)
+        removeAllVisitedLinks();
+}
+
 } // namespace WebCore
index 984f0aea70e82edd2e8ad6e763d0e11495b59678..8d7f480c3964d898979f6d9677756dc19f73464f 100644 (file)
@@ -51,6 +51,8 @@ namespace WebCore {
         void addVisitedLink(const KURL&);
         void addVisitedLink(const UChar*, size_t);
         void removeVisitedLinks();
+
+        static void setShouldTrackVisitedLinks(bool);
         static void removeAllVisitedLinks();
 
     private:
index 3c348efaf098b535a45dbaf6209fc8383a86f5aa..a1d9dbeb459eec7b7b7561422ce47b6fff1ea390 100644 (file)
@@ -1,3 +1,14 @@
+2008-03-06  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mitz.
+
+        - fix regression test failures from the visited-link change
+
+        * History/WebHistory.mm:
+        (+[WebHistory setOptionalSharedHistory:]): Call PageGroup::setShouldTrackVisitedLinks
+        to turn off visited links if there is no history object. Also call
+        removeAllVisitedLinks so we can start over from scratch with the new history.
+
 2008-03-06  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler.
index 0b5b0e7bf1124191722019f514c3e86561f7eca2..a68979ca4d86f8aab176143d85107453782834bd 100644 (file)
@@ -643,12 +643,14 @@ WebHistoryDateKey timeIntervalForBeginningOfDay(NSTimeInterval interval)
 
 + (void)setOptionalSharedHistory:(WebHistory *)history
 {
+    if (_sharedHistory == history)
+        return;
     // FIXME: Need to think about multiple instances of WebHistory per application
     // and correct synchronization of history file between applications.
-    if (_sharedHistory != history) {
-        [_sharedHistory release];
-        _sharedHistory = [history retain];
-    }
+    [_sharedHistory release];
+    _sharedHistory = [history retain];
+    PageGroup::setShouldTrackVisitedLinks(history);
+    PageGroup::removeAllVisitedLinks();
 }
 
 - (id)init
index 408f4d53a7c381c184179f530f24b55681408fd4..123e0fbb4c86fc2ed125c04d59782b37e2acdee5 100644 (file)
@@ -1,3 +1,19 @@
+2008-03-06  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mitz.
+
+        - fix regression test failures and crashes from the visited-link change
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::populateVisitedLinks): Check for null before calling
+        addVisitedLinksToPageGroup.
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::updateGlobalHistory): Ditto.
+        * WebHistory.cpp:
+        (WebHistory::setOptionalSharedHistory): Call PageGroup::setShouldTrackVisitedLinks
+        to turn off visited links if there is no history object. Also call
+        removeAllVisitedLinks so we can start over from scratch with the new history.
+
 2008-03-06  Matt Lilek  <webkit@mattlilek.com>
 
         Reviewed by Adam Roben.
index be54f29c1f54c67b07abe31d1789c5c317dab95c..a05362356bfd369f21abcbd7e0098451be0ac84b 100644 (file)
@@ -500,7 +500,10 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
 
 void WebChromeClient::populateVisitedLinks()
 {
-    WebHistory::sharedHistory()->addVisitedLinksToPageGroup(m_webView->page()->group());
+    WebHistory* history = WebHistory::sharedHistory();
+    if (!history)
+        return;
+    history->addVisitedLinksToPageGroup(m_webView->page()->group());
 }
 
 COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate()
index 1cb5f7b9dfc8eba6a75b896195224d55b2ac6b43..f52caf04c3c41231667822ae7ff36b783d83290b 100644 (file)
@@ -429,7 +429,10 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
 
 void WebFrameLoaderClient::updateGlobalHistory(const KURL& url)
 {
-    WebHistory::sharedHistory()->addItem(url, core(m_webFrame)->loader()->documentLoader()->title());                 
+    WebHistory* history = WebHistory::sharedHistory();
+    if (!history)
+        return;
+    history->addItem(url, core(m_webFrame)->loader()->documentLoader()->title());                 
 }
 
 bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
index f584c7efa9137beae9b50727c089c4d1090b3c3e..be701d2af0b62c00949105a5e595cf716f632439 100644 (file)
@@ -192,7 +192,11 @@ HRESULT STDMETHODCALLTYPE WebHistory::optionalSharedHistory(
 HRESULT STDMETHODCALLTYPE WebHistory::setOptionalSharedHistory( 
     /* [in] */ IWebHistory* history)
 {
+    if (sharedHistoryStorage() == history)
+        return S_OK;
     sharedHistoryStorage().query(history);
+    PageGroup::setShouldTrackVisitedLinks(sharedHistoryStorage());
+    PageGroup::removeAllVisitedLinks();
     return S_OK;
 }