Changeset 71097 in webkit


Ignore:
Timestamp:
Nov 1, 2010 7:42:26 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-01 Jenn Braithwaite <jennb@chromium.org>

Reviewed by Adam Roben.

Windows: Update resource tracking when moving a frame between documents
https://bugs.webkit.org/show_bug.cgi?id=48364

  • Interfaces/IWebResourceLoadDelegatePrivate2.idl:Added Added removeIdentifierForRequest.
  • Interfaces/WebKit.idl: Added IWebResourceLoadDelegatePrivate2.idl.
  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::transferLoadingResourceFromPage):

2010-11-01 Jenn Braithwaite <jennb@chromium.org>

Reviewed by Adam Roben.

Windows: Update resource tracking when moving a frame between documents
https://bugs.webkit.org/show_bug.cgi?id=48364

  • DumpRenderTree/win/DumpRenderTree.cpp: (createWebViewAndOffscreenWindow): (main): Give each WebView its own ResourceLoadDelegate instance in order to make assertions about resource ids on a particular WebView.
  • DumpRenderTree/win/ResourceLoadDelegate.cpp: (ResourceLoadDelegate::identifierForInitialRequest): Always add id to the map. (ResourceLoadDelegate::removeIdentifierForRequest): Added. (ResourceLoadDelegate::willSendRequest): (ResourceLoadDelegate::didReceiveAuthenticationChallenge): (ResourceLoadDelegate::didReceiveResponse): (ResourceLoadDelegate::didFinishLoadingFromDataSource): (ResourceLoadDelegate::didFailLoadingWithError): (ResourceLoadDelegate::descriptionSuitableForTestResult): Replace static descriptionSuitableForTestResult with static member function to access identifier map.
  • DumpRenderTree/win/ResourceLoadDelegate.h: (ResourceLoadDelegate::urlMap): Moved within class so that each WebView has its own id map.
Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r71041 r71097  
     12010-11-01  Jenn Braithwaite  <jennb@chromium.org>
     2
     3        Reviewed by Adam Roben.
     4
     5        Windows: Update resource tracking when moving a frame between documents
     6        https://bugs.webkit.org/show_bug.cgi?id=48364
     7
     8        * Interfaces/IWebResourceLoadDelegatePrivate2.idl:Added
     9        Added removeIdentifierForRequest.
     10        * Interfaces/WebKit.idl:
     11        Added IWebResourceLoadDelegatePrivate2.idl.
     12        * WebCoreSupport/WebFrameLoaderClient.cpp:
     13        (WebFrameLoaderClient::transferLoadingResourceFromPage):
     14
    1152010-11-01  Brady Eidson  <beidson@apple.com>
    216
  • trunk/WebKit/win/Interfaces/WebKit.idl

    r70988 r71097  
    118118#include "IWebResourceLoadDelegate.idl"
    119119#include "IWebResourceLoadDelegatePrivate.idl"
     120#include "IWebResourceLoadDelegatePrivate2.idl"
    120121#include "IWebScriptWorld.idl"
    121122#include "IWebScrollBarDelegatePrivate.idl"
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r71032 r71097  
    748748}
    749749
    750 void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*)
    751 {
     750void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request, Page* oldPage)
     751{
     752    assignIdentifierToInitialRequest(identifier, loader, request);
     753
     754    WebView* oldWebView = kit(oldPage);
     755    if (!oldWebView)
     756        return;
     757
     758    COMPtr<IWebResourceLoadDelegate> oldResourceLoadDelegate;
     759    if (FAILED(oldWebView->resourceLoadDelegate(&oldResourceLoadDelegate)))
     760        return;
     761
     762    COMPtr<IWebResourceLoadDelegatePrivate2> oldResourceLoadDelegatePrivate2(Query, oldResourceLoadDelegate);
     763    if (!oldResourceLoadDelegatePrivate2)
     764        return;
     765    oldResourceLoadDelegatePrivate2->removeIdentifierForRequest(oldWebView, identifier);
    752766}
    753767
  • trunk/WebKitTools/ChangeLog

    r71083 r71097  
     12010-11-01  Jenn Braithwaite  <jennb@chromium.org>
     2
     3        Reviewed by Adam Roben.
     4
     5        Windows: Update resource tracking when moving a frame between documents
     6        https://bugs.webkit.org/show_bug.cgi?id=48364
     7
     8        * DumpRenderTree/win/DumpRenderTree.cpp:
     9        (createWebViewAndOffscreenWindow):
     10        (main):
     11        Give each WebView its own ResourceLoadDelegate instance in order to
     12        make assertions about resource ids on a particular WebView.
     13        * DumpRenderTree/win/ResourceLoadDelegate.cpp:
     14        (ResourceLoadDelegate::identifierForInitialRequest):
     15        Always add id to the map.
     16        (ResourceLoadDelegate::removeIdentifierForRequest):
     17        Added.
     18        (ResourceLoadDelegate::willSendRequest):
     19        (ResourceLoadDelegate::didReceiveAuthenticationChallenge):
     20        (ResourceLoadDelegate::didReceiveResponse):
     21        (ResourceLoadDelegate::didFinishLoadingFromDataSource):
     22        (ResourceLoadDelegate::didFailLoadingWithError):
     23        (ResourceLoadDelegate::descriptionSuitableForTestResult):
     24        Replace static descriptionSuitableForTestResult with static member function to access identifier map.
     25        * DumpRenderTree/win/ResourceLoadDelegate.h:
     26        (ResourceLoadDelegate::urlMap):
     27        Moved within class so that each WebView has its own id map.
     28
    1292010-11-01  Ojan Vafai  <ojan@chromium.org>
    230
  • trunk/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp

    r70572 r71097  
    9999COMPtr<UIDelegate> sharedUIDelegate;
    100100COMPtr<EditingDelegate> sharedEditingDelegate;
    101 COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate;
    102101COMPtr<HistoryDelegate> sharedHistoryDelegate;
    103102
     
    12021201        return 0;
    12031202
    1204     if (FAILED(webView->setResourceLoadDelegate(sharedResourceLoadDelegate.get())))
     1203    ResourceLoadDelegate* resourceLoadDelegate = new ResourceLoadDelegate();
     1204    HRESULT result = webView->setResourceLoadDelegate(resourceLoadDelegate);
     1205    resourceLoadDelegate->Release(); // The delegate is owned by the WebView, so release our reference to it.
     1206    if (FAILED(result))
    12051207        return 0;
    12061208
     
    12861288    sharedUIDelegate.adoptRef(new UIDelegate);
    12871289    sharedEditingDelegate.adoptRef(new EditingDelegate);
    1288     sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate);
    12891290    sharedHistoryDelegate.adoptRef(new HistoryDelegate);
    12901291
  • trunk/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp

    r63681 r71097  
    3636#include <sstream>
    3737#include <tchar.h>
    38 #include <wtf/HashMap.h>
    3938#include <wtf/Vector.h>
    4039
     
    6160}
    6261
    63 typedef HashMap<unsigned long, wstring> IdentifierMap;
    64 
    65 IdentifierMap& urlMap()
    66 {
    67     static IdentifierMap urlMap;
    68 
    69     return urlMap;
    70 }
    71 
    72 static wstring descriptionSuitableForTestResult(unsigned long identifier)
    73 {
    74     IdentifierMap::iterator it = urlMap().find(identifier);
    75    
    76     if (it == urlMap().end())
     62wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const
     63{
     64    IdentifierMap::const_iterator it = m_urlMap.find(identifier);
     65   
     66    if (it == m_urlMap.end())
    7767        return L"<unknown>";
    7868
     
    8070}
    8171
    82 static wstring descriptionSuitableForTestResult(IWebURLRequest* request)
     72wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request)
    8373{
    8474    if (!request)
     
    10999}
    110100
    111 static wstring descriptionSuitableForTestResult(IWebURLResponse* response)
     101wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLResponse* response)
    112102{
    113103    if (!response)
     
    129119}
    130120
    131 static wstring descriptionSuitableForTestResult(IWebError* error, unsigned long identifier)
     121wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) const
    132122{
    133123    wstring result = L"<NSError ";
     
    198188    else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegate))
    199189        *ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
     190    else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegatePrivate2))
     191        *ppvObject = static_cast<IWebResourceLoadDelegatePrivate2*>(this);
    200192    else
    201193        return E_NOINTERFACE;
     
    225217    /* [in] */ unsigned long identifier)
    226218{
    227     if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
     219    if (!done) {
    228220        BSTR urlStr;
    229221        if (FAILED(request->URL(&urlStr)))
    230222            return E_FAIL;
    231223
     224        ASSERT(!urlMap().contains(identifier));
    232225        urlMap().set(identifier, wstringFromBSTR(urlStr));
     226    }
     227
     228    return S_OK;
     229}
     230
     231HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::removeIdentifierForRequest(
     232    /* [in] */ IWebView* webView,
     233    /* [in] */ unsigned long identifier)
     234{
     235    if (!done) {
     236        ASSERT(urlMap().contains(identifier));
     237        urlMap().remove(identifier);
    233238    }
    234239
     
    352357    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
    353358        printf("%S - didFinishLoading\n",
    354             descriptionSuitableForTestResult(identifier).c_str()),
    355        urlMap().remove(identifier);
    356     }
    357 
    358    return S_OK;
     359            descriptionSuitableForTestResult(identifier).c_str());
     360    }
     361
     362    removeIdentifierForRequest(webView, identifier);
     363
     364    return S_OK;
    359365}
    360366       
     
    369375            descriptionSuitableForTestResult(identifier).c_str(),
    370376            descriptionSuitableForTestResult(error, identifier).c_str());
    371         urlMap().remove(identifier);
    372     }
    373 
    374     return S_OK;
    375 }
     377    }
     378
     379    removeIdentifierForRequest(webView, identifier);
     380
     381    return S_OK;
     382}
  • trunk/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h

    r48363 r71097  
    3131
    3232#include <WebKit/WebKit.h>
     33#include <string>
     34#include <wtf/HashMap.h>
    3335
    34 class ResourceLoadDelegate : public IWebResourceLoadDelegate {
     36class ResourceLoadDelegate : public IWebResourceLoadDelegate, public IWebResourceLoadDelegatePrivate2 {
    3537public:
    3638    ResourceLoadDelegate();
     
    9698        /* [in] */ IWebError *error,
    9799        /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; }
     100
     101    // IWebResourceLoadDelegatePrivate2
     102    virtual HRESULT STDMETHODCALLTYPE removeIdentifierForRequest(
     103        /* [in] */ IWebView *webView,
     104        /* [in] */ unsigned long identifier);
    98105   
    99 protected:
     106private:
     107    static std::wstring descriptionSuitableForTestResult(IWebURLRequest*);
     108    static std::wstring descriptionSuitableForTestResult(IWebURLResponse*);
     109    std::wstring descriptionSuitableForTestResult(unsigned long) const;
     110    std::wstring descriptionSuitableForTestResult(IWebError*, unsigned long) const;
     111
     112    typedef HashMap<unsigned long, std::wstring> IdentifierMap;
     113    IdentifierMap& urlMap() { return m_urlMap; }
     114    IdentifierMap m_urlMap;
     115
    100116    ULONG m_refCount;
    101117};
Note: See TracChangeset for help on using the changeset viewer.