[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:22:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ffa58b9facc4cfc4342ff04f8618d7d7dc632578
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 02:42:26 2010 +0000

    2010-11-01  Jenn Braithwaite  <jennb at 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 at 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.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index cb65428..cc63f38 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-01  Jenn Braithwaite  <jennb at 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  Brady Eidson  <beidson at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate2.idl b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate2.idl
new file mode 100644
index 0000000..7e98e6a
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate2.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebView.idl";
+#endif
+
+interface IWebView;
+
+[
+    object,
+    oleautomation,
+    uuid(3517ADDA-5870-4aab-9A4E-056E65989DF8),
+    pointer_default(unique)
+]
+interface IWebResourceLoadDelegatePrivate2 : IUnknown
+{
+    /*!
+        @method webView:removeIdentifierForRequest
+        @param webView The WebView sending the message.
+        @param identifier An identifier that can be used to track the progress of a resource load across
+        multiple call backs.
+        @discussion This message is sent to notify the delegate to stop using the identifier
+        to track the progress of a resource load.
+        - (void)webView:(WebView *)sender removeIdentifierForRequest:(id)identifier;
+    */
+    HRESULT removeIdentifierForRequest([in] IWebView* webView, [in] unsigned long identifier);
+}
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 37a9ead..3f401be 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -117,6 +117,7 @@ import "ocidl.idl";
 #include "IWebResource.idl"
 #include "IWebResourceLoadDelegate.idl"
 #include "IWebResourceLoadDelegatePrivate.idl"
+#include "IWebResourceLoadDelegatePrivate2.idl"
 #include "IWebScriptWorld.idl"
 #include "IWebScrollBarDelegatePrivate.idl"
 #include "IWebScrollBarPrivate.idl"
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 7d5a1cc..a77c6fb 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -747,8 +747,22 @@ void WebFrameLoaderClient::didTransferChildFrameToNewDocument(Page*)
         m_webFrame->setWebView(webView);
 }
 
-void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*)
+void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request, Page* oldPage)
 {
+    assignIdentifierToInitialRequest(identifier, loader, request);
+
+    WebView* oldWebView = kit(oldPage);
+    if (!oldWebView)
+        return;
+
+    COMPtr<IWebResourceLoadDelegate> oldResourceLoadDelegate;
+    if (FAILED(oldWebView->resourceLoadDelegate(&oldResourceLoadDelegate)))
+        return;
+
+    COMPtr<IWebResourceLoadDelegatePrivate2> oldResourceLoadDelegatePrivate2(Query, oldResourceLoadDelegate);
+    if (!oldResourceLoadDelegatePrivate2)
+        return;
+    oldResourceLoadDelegatePrivate2->removeIdentifierForRequest(oldWebView, identifier);
 }
 
 PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& URL, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer)
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c8b51f5..0413cda 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,31 @@
+2010-11-01  Jenn Braithwaite  <jennb at 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.
+
 2010-11-01  Ojan Vafai  <ojan at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index 5138562..7c3d9b3 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -98,7 +98,6 @@ PolicyDelegate* policyDelegate;
 COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate;
 COMPtr<UIDelegate> sharedUIDelegate;
 COMPtr<EditingDelegate> sharedEditingDelegate;
-COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate;
 COMPtr<HistoryDelegate> sharedHistoryDelegate;
 
 IWebFrame* frame;
@@ -1201,7 +1200,10 @@ IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow)
     if (FAILED(viewEditing->setEditingDelegate(sharedEditingDelegate.get())))
         return 0;
 
-    if (FAILED(webView->setResourceLoadDelegate(sharedResourceLoadDelegate.get())))
+    ResourceLoadDelegate* resourceLoadDelegate = new ResourceLoadDelegate();
+    HRESULT result = webView->setResourceLoadDelegate(resourceLoadDelegate);
+    resourceLoadDelegate->Release(); // The delegate is owned by the WebView, so release our reference to it.
+    if (FAILED(result))
         return 0;
 
     openWindows().append(hostWindow);
@@ -1285,7 +1287,6 @@ int main(int argc, char* argv[])
     sharedFrameLoadDelegate.adoptRef(new FrameLoadDelegate);
     sharedUIDelegate.adoptRef(new UIDelegate);
     sharedEditingDelegate.adoptRef(new EditingDelegate);
-    sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate);
     sharedHistoryDelegate.adoptRef(new HistoryDelegate);
 
     // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
index 825366a..cf17987 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
@@ -35,7 +35,6 @@
 #include <comutil.h>
 #include <sstream>
 #include <tchar.h>
-#include <wtf/HashMap.h>
 #include <wtf/Vector.h>
 
 using namespace std;
@@ -60,26 +59,17 @@ static inline BSTR BSTRFromString(const string& str)
     return result;
 }
 
-typedef HashMap<unsigned long, wstring> IdentifierMap;
-
-IdentifierMap& urlMap()
-{
-    static IdentifierMap urlMap;
-
-    return urlMap;
-}
-
-static wstring descriptionSuitableForTestResult(unsigned long identifier)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const
 {
-    IdentifierMap::iterator it = urlMap().find(identifier);
+    IdentifierMap::const_iterator it = m_urlMap.find(identifier);
     
-    if (it == urlMap().end())
+    if (it == m_urlMap.end())
         return L"<unknown>";
 
     return urlSuitableForTestResult(it->second);
 }
 
-static wstring descriptionSuitableForTestResult(IWebURLRequest* request)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request)
 {
     if (!request)
         return L"(null)";
@@ -108,7 +98,7 @@ static wstring descriptionSuitableForTestResult(IWebURLRequest* request)
     return L"<NSURLRequest URL " + url + L", main document URL " + mainDocumentURL + L", http method " + httpMethod + L">";
 }
 
-static wstring descriptionSuitableForTestResult(IWebURLResponse* response)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLResponse* response)
 {
     if (!response)
         return L"(null)";
@@ -128,7 +118,7 @@ static wstring descriptionSuitableForTestResult(IWebURLResponse* response)
     return L"<NSURLResponse " + url + L", http status code " + wstringFromInt(statusCode) + L">";
 }
 
-static wstring descriptionSuitableForTestResult(IWebError* error, unsigned long identifier)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) const
 {
     wstring result = L"<NSError ";
 
@@ -197,6 +187,8 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::QueryInterface(REFIID riid, void
         *ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
     else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegate))
         *ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
+    else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegatePrivate2))
+        *ppvObject = static_cast<IWebResourceLoadDelegatePrivate2*>(this);
     else
         return E_NOINTERFACE;
 
@@ -224,17 +216,30 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::identifierForInitialRequest(
     /* [in] */ IWebDataSource* dataSource,
     /* [in] */ unsigned long identifier)
 { 
-    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done) {
         BSTR urlStr;
         if (FAILED(request->URL(&urlStr)))
             return E_FAIL;
 
+        ASSERT(!urlMap().contains(identifier));
         urlMap().set(identifier, wstringFromBSTR(urlStr));
     }
 
     return S_OK;
 }
 
+HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::removeIdentifierForRequest(
+    /* [in] */ IWebView* webView,
+    /* [in] */ unsigned long identifier)
+{
+    if (!done) {
+        ASSERT(urlMap().contains(identifier));
+        urlMap().remove(identifier);
+    }
+
+    return S_OK;
+}
+
 HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( 
     /* [in] */ IWebView* webView,
     /* [in] */ unsigned long identifier,
@@ -351,11 +356,12 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource(
 {
     if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         printf("%S - didFinishLoading\n",
-            descriptionSuitableForTestResult(identifier).c_str()),
-       urlMap().remove(identifier);
+            descriptionSuitableForTestResult(identifier).c_str());
     }
 
-   return S_OK;
+    removeIdentifierForRequest(webView, identifier);
+
+    return S_OK;
 }
         
 HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError( 
@@ -368,8 +374,9 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError(
         printf("%S - didFailLoadingWithError: %S\n", 
             descriptionSuitableForTestResult(identifier).c_str(),
             descriptionSuitableForTestResult(error, identifier).c_str());
-        urlMap().remove(identifier);
     }
 
+    removeIdentifierForRequest(webView, identifier);
+
     return S_OK;
 }
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
index 924727b..3f20f47 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
@@ -30,8 +30,10 @@
 #define ResourceLoadDelegate_h
 
 #include <WebKit/WebKit.h>
+#include <string>
+#include <wtf/HashMap.h>
 
-class ResourceLoadDelegate : public IWebResourceLoadDelegate {
+class ResourceLoadDelegate : public IWebResourceLoadDelegate, public IWebResourceLoadDelegatePrivate2 {
 public:
     ResourceLoadDelegate();
     virtual ~ResourceLoadDelegate();
@@ -95,8 +97,22 @@ public:
         /* [in] */ IWebView *webView,
         /* [in] */ IWebError *error,
         /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; }
+
+    // IWebResourceLoadDelegatePrivate2
+    virtual HRESULT STDMETHODCALLTYPE removeIdentifierForRequest(
+        /* [in] */ IWebView *webView,
+        /* [in] */ unsigned long identifier);
     
-protected:
+private:
+    static std::wstring descriptionSuitableForTestResult(IWebURLRequest*);
+    static std::wstring descriptionSuitableForTestResult(IWebURLResponse*);
+    std::wstring descriptionSuitableForTestResult(unsigned long) const;
+    std::wstring descriptionSuitableForTestResult(IWebError*, unsigned long) const;
+
+    typedef HashMap<unsigned long, std::wstring> IdentifierMap;
+    IdentifierMap& urlMap() { return m_urlMap; }
+    IdentifierMap m_urlMap;
+
     ULONG m_refCount;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list