Changeset 49564 in webkit


Ignore:
Timestamp:
Oct 14, 2009 9:03:31 AM (15 years ago)
Author:
beidson@apple.com
Message:

WebKit Win API should provide a delegate interface for global history.
https://bugs.webkit.org/show_bug.cgi?id=29905

Reviewed by Sam Weinig.

WebKit/win:

-Add IWebHistoryDelegate for clients to implement.
-Add (I)WebNavigationData for the history delegate's use.
-When it exists, call the history delegate instead of using WebHistory.

  • Interfaces/IWebHistoryDelegate.idl: Added.
  • Interfaces/IWebHistoryPrivate.idl:
  • Interfaces/IWebNavigationData.idl: Added.
  • Interfaces/IWebViewPrivate.idl:
  • Interfaces/WebKit.idl:


  • WebKit.vcproj/Interfaces.vcproj:
  • WebKit.vcproj/WebKit.vcproj:
  • WebCoreSupport/WebChromeClient.cpp:

(WebChromeClient::populateVisitedLinks):

  • WebCoreSupport/WebFrameLoaderClient.cpp:

(WebFrameLoaderClient::updateGlobalHistory):
(WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
(WebFrameLoaderClient::setTitle):

  • WebView.cpp:

(WebView::close):
(WebView::mainFrameURL):
(WebView::setHistoryDelegate):
(WebView::historyDelegate):
(WebView::addVisitedLinks):

  • WebView.h:


  • WebHistory.cpp:

(WebHistory::setVisitedLinkTrackingEnabled):
(WebHistory::removeAllVisitedLinks):

  • WebHistory.h:
  • WebNavigationData.cpp: Added.

(WebNavigationData::QueryInterface):
(WebNavigationData::AddRef):
(WebNavigationData::Release):
(WebNavigationData::WebNavigationData):
(WebNavigationData::~WebNavigationData):
(WebNavigationData::createInstance):
(WebNavigationData::url):
(WebNavigationData::title):
(WebNavigationData::originalRequest):
(WebNavigationData::response):
(WebNavigationData::hasSubstituteData):
(WebNavigationData::clientRedirectSource):

  • WebNavigationData.h: Added.

WebKitTools:

  • DumpRenderTree/LayoutTestController.cpp:

(LayoutTestController::LayoutTestController):

  • DumpRenderTree/LayoutTestController.h:

(LayoutTestController::dumpHistoryDelegateCallbacks):
(LayoutTestController::setDumpHistoryDelegateCallbacks):

  • DumpRenderTree/win/DumpRenderTree.cpp:

(shouldLogHistoryDelegates):
(runTest):
(createWebViewAndOffscreenWindow):
(main):

  • DumpRenderTree/win/DumpRenderTree.vcproj:


Add the IWebHistoryDelegate to DRT Windows:

  • DumpRenderTree/win/HistoryDelegate.cpp: Added.

(wstringFromBSTR):
(HistoryDelegate::HistoryDelegate):
(HistoryDelegate::~HistoryDelegate):
(HistoryDelegate::QueryInterface):
(HistoryDelegate::AddRef):
(HistoryDelegate::Release):
(HistoryDelegate::didNavigateWithNavigationData):
(HistoryDelegate::didPerformClientRedirectFromURL):
(HistoryDelegate::didPerformServerRedirectFromURL):
(HistoryDelegate::updateHistoryTitle):
(HistoryDelegate::populateVisitedLinksForWebView):

  • DumpRenderTree/win/HistoryDelegate.h: Added.
  • DumpRenderTree/win/LayoutTestControllerWin.cpp:

(LayoutTestController::removeAllVisitedLinks):

LayoutTests:

  • platform/win/Skipped: Enable globalhistory tests.
Location:
trunk
Files:
6 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r49562 r49564  
    1 2009-10-02  Yong Li  <yong.li@torchmobile.com>
    2 
    3         Reviewed by NOBODY Adele Peterson.
     12009-10-14  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKit Win API should provide a delegate interface for global history.
     6        https://bugs.webkit.org/show_bug.cgi?id=29905
     7
     8        * platform/win/Skipped: Enable globalhistory tests.
     9
     102009-10-14  Yong Li  <yong.li@torchmobile.com>
     11
     12        Reviewed by Adele Peterson.
    413
    514        Added a test case that loads an invalid image to make sure
  • trunk/LayoutTests/platform/win/Skipped

    r49532 r49564  
    681681fast/dom/Window/slow_unload_handler.html
    682682
    683 # This port doesn't have a global history delegate yet
    684 http/tests/globalhistory
    685 
    686683# <https://bugs.webkit.org/show_bug.cgi?id=29966>
    687684fast/inline/relative-positioned-overflow.html
  • trunk/WebKit/win/ChangeLog

    r49550 r49564  
     12009-10-14  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKit Win API should provide a delegate interface for global history.
     6        https://bugs.webkit.org/show_bug.cgi?id=29905
     7
     8        -Add IWebHistoryDelegate for clients to implement.
     9        -Add (I)WebNavigationData for the history delegate's use.
     10        -When it exists, call the history delegate instead of using WebHistory.
     11       
     12        * Interfaces/IWebHistoryDelegate.idl: Added.
     13        * Interfaces/IWebHistoryPrivate.idl:
     14        * Interfaces/IWebNavigationData.idl: Added.
     15        * Interfaces/IWebViewPrivate.idl:
     16        * Interfaces/WebKit.idl:
     17       
     18        * WebKit.vcproj/Interfaces.vcproj:
     19        * WebKit.vcproj/WebKit.vcproj:
     20
     21        * WebCoreSupport/WebChromeClient.cpp:
     22        (WebChromeClient::populateVisitedLinks):
     23        * WebCoreSupport/WebFrameLoaderClient.cpp:
     24        (WebFrameLoaderClient::updateGlobalHistory):
     25        (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
     26        (WebFrameLoaderClient::setTitle):
     27 
     28         * WebView.cpp:
     29        (WebView::close):
     30        (WebView::mainFrameURL):
     31        (WebView::setHistoryDelegate):
     32        (WebView::historyDelegate):
     33        (WebView::addVisitedLinks):
     34        * WebView.h:
     35       
     36        * WebHistory.cpp:
     37        (WebHistory::setVisitedLinkTrackingEnabled):
     38        (WebHistory::removeAllVisitedLinks):
     39        * WebHistory.h:
     40
     41        * WebNavigationData.cpp: Added.
     42        (WebNavigationData::QueryInterface):
     43        (WebNavigationData::AddRef):
     44        (WebNavigationData::Release):
     45        (WebNavigationData::WebNavigationData):
     46        (WebNavigationData::~WebNavigationData):
     47        (WebNavigationData::createInstance):
     48        (WebNavigationData::url):
     49        (WebNavigationData::title):
     50        (WebNavigationData::originalRequest):
     51        (WebNavigationData::response):
     52        (WebNavigationData::hasSubstituteData):
     53        (WebNavigationData::clientRedirectSource):
     54        * WebNavigationData.h: Added.
     55
    1562009-10-13  Dave Hyatt  <hyatt@apple.com>
    257
  • trunk/WebKit/win/Interfaces/IWebHistoryPrivate.idl

    r42463 r49564  
    3737    HRESULT allItems([in, out] int* count, [out, retval] IWebHistoryItem** items);
    3838    HRESULT data([out, retval] IStream**);
     39    HRESULT setVisitedLinkTrackingEnabled([in] BOOL visitedLinkTrackingEnable);
     40    HRESULT removeAllVisitedLinks();
    3941}
  • trunk/WebKit/win/Interfaces/IWebViewPrivate.idl

    r49541 r49564  
    2929import "IWebFormDelegate.idl";
    3030import "IWebFrameLoadDelegatePrivate.idl";
     31import "IWebHistoryDelegate.idl";
    3132import "IWebInspector.idl";
    3233import "IWebInspectorPrivate.idl";
     
    3940interface IWebFormDelegate;
    4041interface IWebFrameLoadDelegatePrivate;
     42interface IWebHistoryDelegate;
    4143interface IWebInspector;
    4244interface IWebInspectorPrivate;
     
    211213    // Removes all white list entries created with whiteListAccessFromOrigin.
    212214    HRESULT resetOriginAccessWhiteLists();
     215
     216    HRESULT setHistoryDelegate([in] IWebHistoryDelegate* historyDelegate);
     217    HRESULT historyDelegate([out,retval] IWebHistoryDelegate** historyDelegate);
     218    HRESULT addVisitedLinks([in] BSTR* visitedURLs, [in] unsigned visitedURLCount);
    213219}
  • trunk/WebKit/win/Interfaces/WebKit.idl

    r49091 r49564  
    9191#include "IWebHTTPURLResponse.idl"
    9292#include "IWebHistory.idl"
     93#include "IWebHistoryDelegate.idl"
    9394#include "IWebHistoryItem.idl"
    9495#include "IWebHistoryItemPrivate.idl"
     
    101102#include "IWebKitStatistics.idl"
    102103#include "IWebMutableURLRequestPrivate.idl"
     104#include "IWebNavigationData.idl"
    103105#include "IWebNotification.idl"
    104106#include "IWebNotificationCenter.idl"
  • trunk/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r48511 r49564  
    572572void WebChromeClient::populateVisitedLinks()
    573573{
     574    COMPtr<IWebHistoryDelegate> historyDelegate;
     575    m_webView->historyDelegate(&historyDelegate);
     576    if (historyDelegate) {
     577        historyDelegate->populateVisitedLinksForWebView(m_webView);
     578        return;
     579    }
     580
    574581    WebHistory* history = WebHistory::sharedHistory();
    575582    if (!history)
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r49320 r49564  
    4444#include "WebHistoryItem.h"
    4545#include "WebMutableURLRequest.h"
     46#include "WebNavigationData.h"
    4647#include "WebNotificationCenter.h"
    4748#include "WebSecurityOrigin.h"
     
    494495void WebFrameLoaderClient::updateGlobalHistory()
    495496{
     497    DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
     498    WebView* webView = m_webFrame->webView();
     499    COMPtr<IWebHistoryDelegate> historyDelegate;
     500    webView->historyDelegate(&historyDelegate);
     501
     502    if (historyDelegate) {
     503        BString url(loader->urlForHistory());
     504        BString title(loader->title());
     505        BString redirectSource(loader->clientRedirectSourceForHistory());
     506        COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(loader->response()));
     507        COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy()));
     508       
     509        COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(
     510            url, title, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), redirectSource));
     511
     512        historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
     513        return;
     514    }
     515
    496516    WebHistory* history = WebHistory::sharedHistory();
    497517    if (!history)
    498518        return;
    499519
    500     DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
    501520    history->visitedURL(loader->urlForHistory(), loader->title(), loader->originalRequestCopy().httpMethod(), loader->urlForHistoryReflectsFailure(), !loader->clientRedirectSourceForHistory());
    502521}
     
    504523void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
    505524{
     525    WebView* webView = m_webFrame->webView();
     526    COMPtr<IWebHistoryDelegate> historyDelegate;
     527    webView->historyDelegate(&historyDelegate);
     528
    506529    WebHistory* history = WebHistory::sharedHistory();
    507     if (!history)
    508         return;
    509530
    510531    DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
     
    512533
    513534    if (!loader->clientRedirectSourceForHistory().isNull()) {
    514         if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->clientRedirectSourceForHistory())) {
    515             COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
    516             webHistoryItem->historyItem()->addRedirectURL(loader->clientRedirectDestinationForHistory());
     535        if (historyDelegate) {
     536            BString sourceURL(loader->clientRedirectSourceForHistory());
     537            BString destURL(loader->clientRedirectDestinationForHistory());
     538            historyDelegate->didPerformClientRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
     539        } else {
     540            if (history) {
     541                if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->clientRedirectSourceForHistory())) {
     542                    COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
     543                    webHistoryItem->historyItem()->addRedirectURL(loader->clientRedirectDestinationForHistory());
     544                }
     545            }
    517546        }
    518547    }
    519548
    520549    if (!loader->serverRedirectSourceForHistory().isNull()) {
    521         if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->serverRedirectSourceForHistory())) {
    522             COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
    523             webHistoryItem->historyItem()->addRedirectURL(loader->serverRedirectDestinationForHistory());
     550        if (historyDelegate) {
     551            BString sourceURL(loader->serverRedirectSourceForHistory());
     552            BString destURL(loader->serverRedirectDestinationForHistory());
     553            historyDelegate->didPerformServerRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
     554        } else {
     555            if (history) {
     556                if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->serverRedirectSourceForHistory())) {
     557                    COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
     558                    webHistoryItem->historyItem()->addRedirectURL(loader->serverRedirectDestinationForHistory());
     559                }
     560            }
    524561        }
    525562    }
     
    573610void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
    574611{
     612    WebView* webView = m_webFrame->webView();
     613    COMPtr<IWebHistoryDelegate> historyDelegate;
     614    webView->historyDelegate(&historyDelegate);
     615    if (historyDelegate) {
     616        BString titleBSTR(title);
     617        BString urlBSTR(url.string());
     618        historyDelegate->updateHistoryTitle(webView, titleBSTR, urlBSTR);
     619        return;
     620    }
     621
    575622    BOOL privateBrowsingEnabled = FALSE;
    576623    COMPtr<IWebPreferences> preferences;
  • trunk/WebKit/win/WebHistory.cpp

    r48770 r49564  
    578578}
    579579
     580HRESULT WebHistory::setVisitedLinkTrackingEnabled(BOOL visitedLinkTrackingEnabled)
     581{
     582    PageGroup::setShouldTrackVisitedLinks(visitedLinkTrackingEnabled);
     583    return S_OK;
     584}
     585
     586HRESULT WebHistory::removeAllVisitedLinks()
     587{
     588    PageGroup::removeAllVisitedLinks();
     589    return S_OK;
     590}
     591
    580592HRESULT STDMETHODCALLTYPE WebHistory::setHistoryItemLimit(
    581593    /* [in] */ int limit)
  • trunk/WebKit/win/WebHistory.h

    r45681 r49564  
    117117    virtual HRESULT STDMETHODCALLTYPE data(IStream**);
    118118
     119    virtual HRESULT STDMETHODCALLTYPE setVisitedLinkTrackingEnabled(BOOL visitedLinkTrackingEnable);
     120    virtual HRESULT STDMETHODCALLTYPE removeAllVisitedLinks();
     121
    119122    // WebHistory
    120123    static WebHistory* sharedHistory();
  • trunk/WebKit/win/WebKit.vcproj/Interfaces.vcproj

    r49091 r49564  
    785785                </File>
    786786                <File
     787                        RelativePath="..\Interfaces\IWebHistoryDelegate.idl"
     788                        >
     789                        <FileConfiguration
     790                                Name="Debug|Win32"
     791                                ExcludedFromBuild="true"
     792                                >
     793                                <Tool
     794                                        Name="VCMIDLTool"
     795                                />
     796                        </FileConfiguration>
     797                </File>
     798                <File
    787799                        RelativePath="..\Interfaces\IWebHistoryItem.idl"
    788800                        >
     
    10371049                        <FileConfiguration
    10381050                                Name="Release|Win32"
     1051                                ExcludedFromBuild="true"
     1052                                >
     1053                                <Tool
     1054                                        Name="VCMIDLTool"
     1055                                />
     1056                        </FileConfiguration>
     1057                </File>
     1058                <File
     1059                        RelativePath="..\Interfaces\IWebNavigationData.idl"
     1060                        >
     1061                        <FileConfiguration
     1062                                Name="Debug|Win32"
    10391063                                ExcludedFromBuild="true"
    10401064                                >
  • trunk/WebKit/win/WebKit.vcproj/WebKit.vcproj

    r48884 r49564  
    680680                        </File>
    681681                        <File
     682                                RelativePath="..\WebNavigationData.h"
     683                                >
     684                        </File>
     685                        <File
    682686                                RelativePath="..\WebNodeHighlight.h"
    683687                                >
     
    993997                        <File
    994998                                RelativePath="..\WebMutableURLRequest.cpp"
     999                                >
     1000                        </File>
     1001                        <File
     1002                                RelativePath="..\WebNavigationData.cpp"
    9951003                                >
    9961004                        </File>
  • trunk/WebKit/win/WebView.cpp

    r49550 r49564  
    640640    setFrameLoadDelegate(0);
    641641    setFrameLoadDelegatePrivate(0);
     642    setHistoryDelegate(0);
    642643    setPolicyDelegate(0);
    643644    setResourceLoadDelegate(0);
     
    33613362   
    33623363HRESULT STDMETHODCALLTYPE WebView::mainFrameURL(
    3363         /* [retval][out] */ BSTR* /*urlString*/)
    3364 {
    3365     ASSERT_NOT_REACHED();
    3366     return E_NOTIMPL;
     3364        /* [retval][out] */ BSTR* urlString)
     3365{
     3366    if (!urlString)
     3367        return E_POINTER;
     3368
     3369    if (!m_mainFrame)
     3370        return E_FAIL;
     3371
     3372    COMPtr<IWebDataSource> dataSource;
     3373
     3374    if (FAILED(m_mainFrame->provisionalDataSource(&dataSource))) {
     3375        if (FAILED(m_mainFrame->dataSource(&dataSource)))
     3376            return E_FAIL;
     3377    }
     3378
     3379    if (!dataSource) {
     3380        *urlString = 0;
     3381        return S_OK;
     3382    }
     3383   
     3384    COMPtr<IWebMutableURLRequest> request;
     3385    if (FAILED(dataSource->request(&request)) || !request)
     3386        return E_FAIL;
     3387
     3388    if (FAILED(request->URL(urlString)))
     3389        return E_FAIL;
     3390
     3391    return S_OK;
    33673392}
    33683393   
     
    55875612    return S_OK;
    55885613}
     5614 
     5615HRESULT WebView::setHistoryDelegate(IWebHistoryDelegate* historyDelegate)
     5616{
     5617    m_historyDelegate = historyDelegate;
     5618    return S_OK;
     5619}
     5620
     5621HRESULT WebView::historyDelegate(IWebHistoryDelegate** historyDelegate)
     5622{
     5623    if (!historyDelegate)
     5624        return E_POINTER;
     5625
     5626    return m_historyDelegate.copyRefTo(historyDelegate);
     5627}
     5628
     5629HRESULT WebView::addVisitedLinks(BSTR* visitedURLs, unsigned visitedURLCount)
     5630{
     5631    PageGroup& group = core(this)->group();
     5632   
     5633    for (unsigned i = 0; i < visitedURLCount; ++i) {
     5634        BSTR url = visitedURLs[i];
     5635        unsigned length = SysStringLen(url);
     5636        group.addVisitedLink(url, length);
     5637    }
     5638
     5639    return S_OK;
     5640}
    55895641
    55905642void WebView::downloadURL(const KURL& url)
  • trunk/WebKit/win/WebView.h

    r49541 r49564  
    1212 *
    1313 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     14 * EXPRESS OR IMPLIED WARRANTIES, INCfLUDING, BUT NOT LIMITED TO, THE
    1515 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1616 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
     
    761761    virtual HRESULT STDMETHODCALLTYPE whiteListAccessFromOrigin(BSTR sourceOrigin, BSTR destinationProtocol, BSTR destinationHost, BOOL allowDestinationSubdomains);
    762762    virtual HRESULT STDMETHODCALLTYPE resetOriginAccessWhiteLists();
     763
     764
     765    virtual HRESULT STDMETHODCALLTYPE setHistoryDelegate(IWebHistoryDelegate* historyDelegate);
     766    virtual HRESULT STDMETHODCALLTYPE historyDelegate(IWebHistoryDelegate** historyDelegate);
     767    virtual HRESULT STDMETHODCALLTYPE addVisitedLinks(BSTR* visitedURLs, unsigned visitedURLCount);
    763768
    764769    // WebView
     
    907912    COMPtr<IWebResourceLoadDelegate> m_resourceLoadDelegate;
    908913    COMPtr<IWebDownloadDelegate> m_downloadDelegate;
     914    COMPtr<IWebHistoryDelegate> m_historyDelegate;
    909915    COMPtr<WebPreferences> m_preferences;
    910916    COMPtr<WebInspector> m_webInspector;
  • trunk/WebKitTools/ChangeLog

    r49563 r49564  
     12009-10-14  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKit Win API should provide a delegate interface for global history.
     6        https://bugs.webkit.org/show_bug.cgi?id=29905
     7
     8        * DumpRenderTree/LayoutTestController.cpp:
     9        (LayoutTestController::LayoutTestController):
     10        * DumpRenderTree/LayoutTestController.h:
     11        (LayoutTestController::dumpHistoryDelegateCallbacks):
     12        (LayoutTestController::setDumpHistoryDelegateCallbacks):
     13               
     14        * DumpRenderTree/win/DumpRenderTree.cpp:
     15        (shouldLogHistoryDelegates):
     16        (runTest):
     17        (createWebViewAndOffscreenWindow):
     18        (main):
     19        * DumpRenderTree/win/DumpRenderTree.vcproj:
     20       
     21        Add the IWebHistoryDelegate to DRT Windows:
     22        * DumpRenderTree/win/HistoryDelegate.cpp: Added.
     23        (wstringFromBSTR):
     24        (HistoryDelegate::HistoryDelegate):
     25        (HistoryDelegate::~HistoryDelegate):
     26        (HistoryDelegate::QueryInterface):
     27        (HistoryDelegate::AddRef):
     28        (HistoryDelegate::Release):
     29        (HistoryDelegate::didNavigateWithNavigationData):
     30        (HistoryDelegate::didPerformClientRedirectFromURL):
     31        (HistoryDelegate::didPerformServerRedirectFromURL):
     32        (HistoryDelegate::updateHistoryTitle):
     33        (HistoryDelegate::populateVisitedLinksForWebView):
     34        * DumpRenderTree/win/HistoryDelegate.h: Added.
     35
     36        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     37        (LayoutTestController::removeAllVisitedLinks):
     38
    1392009-10-14  Shu Chang  <Chang.Shu@nokia.com>
    240
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r49369 r49564  
    4949    , m_dumpEditingCallbacks(false)
    5050    , m_dumpFrameLoadCallbacks(false)
     51    , m_dumpHistoryDelegateCallbacks(false)
    5152    , m_dumpResourceLoadCallbacks(false)
    5253    , m_dumpResourceResponseMIMETypes(false)
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r49369 r49564  
    122122    void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; }
    123123
     124    bool dumpHistoryDelegateCallbacks() const { return m_dumpHistoryDelegateCallbacks; }
     125    void setDumpHistoryDelegateCallbacks(bool dumpHistoryDelegateCallbacks) { m_dumpHistoryDelegateCallbacks = dumpHistoryDelegateCallbacks; }
     126   
    124127    bool dumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
    125128    void setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks) { m_dumpResourceLoadCallbacks = dumpResourceLoadCallbacks; }
     
    224227    bool m_dumpEditingCallbacks;
    225228    bool m_dumpFrameLoadCallbacks;
     229    bool m_dumpHistoryDelegateCallbacks;
    226230    bool m_dumpResourceLoadCallbacks;
    227231    bool m_dumpResourceResponseMIMETypes;
  • trunk/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp

    r49488 r49564  
    3232#include "EditingDelegate.h"
    3333#include "FrameLoadDelegate.h"
     34#include "HistoryDelegate.h"
    3435#include "LayoutTestController.h"
    3536#include "PixelDumpSupport.h"
     
    9899COMPtr<EditingDelegate> sharedEditingDelegate;
    99100COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate;
     101COMPtr<HistoryDelegate> sharedHistoryDelegate;
    100102
    101103IWebFrame* frame;
     
    682684}
    683685
     686static bool shouldLogHistoryDelegates(const char* pathOrURL)
     687{
     688    return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\");
     689}
     690
    684691static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
    685692{
     
    837844        gLayoutTestController->setDumpFrameLoadCallbacks(true);
    838845
     846    COMPtr<IWebView> webView;
     847    if (SUCCEEDED(frame->webView(&webView))) {
     848        COMPtr<IWebViewPrivate> viewPrivate;
     849        if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) {
     850            if (shouldLogHistoryDelegates(pathOrURL.c_str())) {
     851                gLayoutTestController->setDumpHistoryDelegateCallbacks(true);           
     852                viewPrivate->setHistoryDelegate(sharedHistoryDelegate.get());
     853            } else
     854                viewPrivate->setHistoryDelegate(0);
     855        }
     856    }
    839857    COMPtr<IWebHistory> history;
    840858    if (SUCCEEDED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history))))
     
    844862
    845863    prevTestBFItem = 0;
    846     COMPtr<IWebView> webView;
    847     if (SUCCEEDED(frame->webView(&webView))) {
     864    if (webView) {
    848865        COMPtr<IWebBackForwardList> bfList;
    849866        if (SUCCEEDED(webView->backForwardList(&bfList)))
     
    10881105        return 0;
    10891106
     1107    if (FAILED(viewPrivate->setHistoryDelegate(sharedHistoryDelegate.get())))
     1108        return 0;
     1109
    10901110    openWindows().append(hostWindow);
    10911111    windowToWebViewMap().set(hostWindow, webView);
     
    11541174    sharedEditingDelegate.adoptRef(new EditingDelegate);
    11551175    sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate);
     1176    sharedHistoryDelegate.adoptRef(new HistoryDelegate);
    11561177
    11571178    // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
  • trunk/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj

    r48692 r49564  
    457457                        </File>
    458458                        <File
     459                                RelativePath=".\HistoryDelegate.cpp"
     460                                >
     461                        </File>
     462                        <File
     463                                RelativePath=".\HistoryDelegate.h"
     464                                >
     465                        </File>
     466                        <File
    459467                                RelativePath=".\PolicyDelegate.cpp"
    460468                                >
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r49496 r49564  
    928928void LayoutTestController::removeAllVisitedLinks()
    929929{
    930     // FIXME: Implement this.
    931 }
     930    COMPtr<IWebHistory> history;
     931    if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history))))
     932        return;
     933
     934    COMPtr<IWebHistory> sharedHistory;
     935    if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory)
     936        return;
     937
     938    COMPtr<IWebHistoryPrivate> sharedHistoryPrivate;
     939    if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate)))
     940        return;
     941
     942    sharedHistoryPrivate->removeAllVisitedLinks();
     943}
Note: See TracChangeset for help on using the changeset viewer.