Title: [140572] trunk/Source
Revision
140572
Author
[email protected]
Date
2013-01-23 12:21:19 -0800 (Wed, 23 Jan 2013)

Log Message

Recursion handling cancelled authentication challenges in NetworkProcess
<rdar://problem/13024541> and https://bugs.webkit.org/show_bug.cgi?id=107702

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* WebCore.exp.in:

Source/WebKit2:

This turned in to both a bug fix with authentication and a minimal refactoring of NetworkResourceLoader.

- Rename ::stop to ::resourceHandleStopped
- Move all cleanup code to ::resourceHandleStopped
- Schedule a resourceHandleStopped call when an authentication cancellation occurs
- Tell the WebResourceLoader to cancel when an authentication cancellation occurs

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::~NetworkResourceLoader):
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::performStops):
(WebKit::NetworkResourceLoader::resourceHandleStopped):
(WebKit::NetworkResourceLoader::didFail):
(WebKit::NetworkResourceLoader::receivedAuthenticationCancellation):
* NetworkProcess/NetworkResourceLoader.h:

* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::cancelResourceLoader):
* WebProcess/Network/WebResourceLoader.h:
* WebProcess/Network/WebResourceLoader.messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140571 => 140572)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 20:21:19 UTC (rev 140572)
@@ -1,3 +1,12 @@
+2013-01-23  Brady Eidson  <[email protected]>
+
+        Recursion handling cancelled authentication challenges in NetworkProcess
+        <rdar://problem/13024541> and https://bugs.webkit.org/show_bug.cgi?id=107702
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebCore.exp.in:
+
 2013-01-23  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=107628

Modified: trunk/Source/WebCore/WebCore.exp.in (140571 => 140572)


--- trunk/Source/WebCore/WebCore.exp.in	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-01-23 20:21:19 UTC (rev 140572)
@@ -302,6 +302,7 @@
 __ZN7WebCore14ResourceHandle26synchronousLoadRunLoopModeEv
 __ZN7WebCore14ResourceHandle6createEPNS_17NetworkingContextERKNS_15ResourceRequestEPNS_20ResourceHandleClientEbb
 __ZN7WebCore14ResourceLoader14cancelledErrorEv
+__ZN7WebCore14ResourceLoader6cancelEv
 __ZN7WebCore14SchemeRegistry24registerURLSchemeAsLocalERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry25registerURLSchemeAsSecureERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry27registerURLSchemeAsNoAccessERKN3WTF6StringE

Modified: trunk/Source/WebKit2/ChangeLog (140571 => 140572)


--- trunk/Source/WebKit2/ChangeLog	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-23 20:21:19 UTC (rev 140572)
@@ -1,3 +1,31 @@
+2013-01-23  Brady Eidson  <[email protected]>
+
+        Recursion handling cancelled authentication challenges in NetworkProcess
+        <rdar://problem/13024541> and https://bugs.webkit.org/show_bug.cgi?id=107702
+
+        Reviewed by Alexey Proskuryakov.
+
+        This turned in to both a bug fix with authentication and a minimal refactoring of NetworkResourceLoader.
+
+        - Rename ::stop to ::resourceHandleStopped
+        - Move all cleanup code to ::resourceHandleStopped
+        - Schedule a resourceHandleStopped call when an authentication cancellation occurs
+        - Tell the WebResourceLoader to cancel when an authentication cancellation occurs
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::~NetworkResourceLoader):
+        (WebKit::NetworkResourceLoader::start):
+        (WebKit::NetworkResourceLoader::performStops):
+        (WebKit::NetworkResourceLoader::resourceHandleStopped):
+        (WebKit::NetworkResourceLoader::didFail):
+        (WebKit::NetworkResourceLoader::receivedAuthenticationCancellation):
+        * NetworkProcess/NetworkResourceLoader.h:
+
+        * WebProcess/Network/WebResourceLoader.cpp:
+        (WebKit::WebResourceLoader::cancelResourceLoader):
+        * WebProcess/Network/WebResourceLoader.h:
+        * WebProcess/Network/WebResourceLoader.messages.in:
+
 2013-01-23  Christophe Dumez  <[email protected]>
 
         [EFL][WK2] Use C API inside ewk_cookie_manager

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (140571 => 140572)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-01-23 20:21:19 UTC (rev 140572)
@@ -56,6 +56,7 @@
 NetworkResourceLoader::~NetworkResourceLoader()
 {
     ASSERT(isMainThread());
+    ASSERT(!m_handle);
 }
 
 CoreIPC::Connection* NetworkResourceLoader::connection() const
@@ -72,7 +73,7 @@
 {
     ASSERT(isMainThread());
 
-    // Explicit ref() balanced by a deref() in NetworkResourceLoader::stop()
+    // Explicit ref() balanced by a deref() in NetworkResourceLoader::resourceHandleStopped()
     ref();
     
     // FIXME (NetworkProcess): Create RemoteNetworkingContext with actual settings.
@@ -120,16 +121,21 @@
     }
     
     for (size_t i = 0; i < requests.size(); ++i)
-        requests[i]->stop();
+        requests[i]->resourceHandleStopped();
 }
 
-void NetworkResourceLoader::stop()
+void NetworkResourceLoader::resourceHandleStopped()
 {
     ASSERT(isMainThread());
 
-    // Remove this load identifier soon so we can start more network requests.
+    if (FormData* formData = loadParameters().request().httpBody())
+        formData->removeGeneratedFilesIfNeeded();
+
+    m_handle = 0;
+
+    // Tell the scheduler about this finished loader soon so it can start more network requests.
     NetworkProcess::shared().networkResourceLoadScheduler().scheduleRemoveLoader(this);
-    
+
     // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
     // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
     deref();
@@ -164,8 +170,6 @@
 {
     // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here.
     // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread.
-    if (FormData* formData = loadParameters().request().httpBody())
-        formData->removeGeneratedFilesIfNeeded();
     send(Messages::WebResourceLoader::DidFailResourceLoad(error));
     scheduleStopOnMainThread();
 }
@@ -272,8 +276,11 @@
     if (m_currentAuthenticationChallenge->identifier() != challenge.identifier())
         return;
 
-    m_currentAuthenticationChallenge->authenticationClient()->receivedCancellation(*m_currentAuthenticationChallenge);
+    m_handle->cancel();
     m_currentAuthenticationChallenge.clear();
+
+    send(Messages::WebResourceLoader::CancelResourceLoader());
+    scheduleStopOnMainThread();
 }
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (140571 => 140572)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2013-01-23 20:21:19 UTC (rev 140572)
@@ -109,7 +109,7 @@
     void scheduleStopOnMainThread();
     static void performStops(void*);
 
-    void stop();
+    void resourceHandleStopped();
 
     RefPtr<RemoteNetworkingContext> m_networkingContext;
     RefPtr<WebCore::ResourceHandle> m_handle;    

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (140571 => 140572)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2013-01-23 20:21:19 UTC (rev 140572)
@@ -68,6 +68,11 @@
     return m_coreLoader->identifier();
 }
 
+void WebResourceLoader::cancelResourceLoader()
+{
+    m_coreLoader->cancel();
+}
+
 void WebResourceLoader::willSendRequest(const ResourceRequest& proposedRequest, const ResourceResponse& redirectResponse, ResourceRequest& newRequest)
 {
     LOG(Network, "(WebProcess) WebResourceLoader::willSendRequest to '%s'", proposedRequest.url().string().utf8().data());

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (140571 => 140572)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h	2013-01-23 20:21:19 UTC (rev 140572)
@@ -80,6 +80,8 @@
 private:
     WebResourceLoader(PassRefPtr<WebCore::ResourceLoader>);
 
+    void cancelResourceLoader();
+
     void willSendRequest(const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::ResourceRequest& newRequest);
     void didReceiveResponseWithCertificateInfo(const WebCore::ResourceResponse&, const PlatformCertificateInfo&);
     void didReceiveData(const CoreIPC::DataReference&, int64_t encodedDataLength, bool allAtOnce);

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in (140571 => 140572)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in	2013-01-23 20:17:01 UTC (rev 140571)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in	2013-01-23 20:21:19 UTC (rev 140572)
@@ -22,6 +22,8 @@
 
 messages -> WebResourceLoader {
 
+    CancelResourceLoader()
+
     // FIXME (NetworkProcess): We'll need much more granularity for response messages.
     WillSendRequest(WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse) -> (WebCore::ResourceRequest newRequest)
     DidReceiveResponseWithCertificateInfo(WebCore::ResourceResponse response, WebKit::PlatformCertificateInfo certificateInfo)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to