Title: [147476] trunk/Source
Revision
147476
Author
[email protected]
Date
2013-04-02 11:36:35 -0700 (Tue, 02 Apr 2013)

Log Message

        <rdar://problem/13551119> [WK2] Crashes in NetworkProcess when canceling loads
        https://bugs.webkit.org/show_bug.cgi?id=113803

        Reviewed by Darin Adler.

        Stop using a delegate proxy. It hasn't been needed in years, and the extra layer
        just adds bugs.

        This specific issue gets fixed because connection retains its delegate is retained,
        but a proxy does not.

        * WebCore.exp.in:
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceHandleInternal.h:
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::start):
        (WebCore::ResourceHandle::releaseDelegate):
        (WebCore::ResourceHandle::platformLoadResourceSynchronously):
        Removed code that was dealing with delegate proxy.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147475 => 147476)


--- trunk/Source/WebCore/ChangeLog	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebCore/ChangeLog	2013-04-02 18:36:35 UTC (rev 147476)
@@ -1,3 +1,25 @@
+2013-04-02  Alexey Proskuryakov  <[email protected]>
+
+        <rdar://problem/13551119> [WK2] Crashes in NetworkProcess when canceling loads
+        https://bugs.webkit.org/show_bug.cgi?id=113803
+
+        Reviewed by Darin Adler.
+
+        Stop using a delegate proxy. It hasn't been needed in years, and the extra layer
+        just adds bugs.
+
+        This specific issue gets fixed because connection retains its delegate is retained,
+        but a proxy does not.
+
+        * WebCore.exp.in:
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleInternal.h:
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::releaseDelegate):
+        (WebCore::ResourceHandle::platformLoadResourceSynchronously):
+        Removed code that was dealing with delegate proxy.
+
 2013-04-02  John J. Barton  <[email protected]>
 
         Web Inspector: Encapsulate SetEmbedderData/GetEmbedderData

Modified: trunk/Source/WebCore/WebCore.exp.in (147475 => 147476)


--- trunk/Source/WebCore/WebCore.exp.in	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-04-02 18:36:35 UTC (rev 147476)
@@ -2351,8 +2351,6 @@
 _wkGetDefaultHTTPCookieStorage
 _wkSetCFURLRequestShouldContentSniff
 _wkSetRequestStorageSession
-#else
-__ZN7WebCore14ResourceHandle12releaseProxyEv
 #endif
 
 #if ENABLE(BLOB)

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (147475 => 147476)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2013-04-02 18:36:35 UTC (rev 147476)
@@ -127,7 +127,6 @@
     NSURLConnection *connection() const;
     id delegate();
     void releaseDelegate();
-    id releaseProxy();
 #endif
 
     void schedule(WTF::SchedulePair*);

Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (147475 => 147476)


--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2013-04-02 18:36:35 UTC (rev 147476)
@@ -161,7 +161,6 @@
 #if PLATFORM(MAC) && !USE(CFNETWORK)
         RetainPtr<NSURLConnection> m_connection;
         RetainPtr<id> m_delegate;
-        RetainPtr<id> m_proxy;
 #endif
 #if PLATFORM(MAC)
         bool m_startWhenScheduled;

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (147475 => 147476)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2013-04-02 18:36:35 UTC (rev 147476)
@@ -59,13 +59,6 @@
 
 using namespace WebCore;
 
-// WebCoreNSURLConnectionDelegateProxy exists so that we can cast m_proxy to it in order
-// to disambiguate the argument type in the -setDelegate: call.  This avoids a spurious
-// warning that the compiler would otherwise emit.
-@interface WebCoreNSURLConnectionDelegateProxy : NSObject <NSURLConnectionDelegate>
-- (void)setDelegate:(id<NSURLConnectionDelegate>)delegate;
-@end
-
 @interface NSURLConnection (Details)
 -(id)_initWithRequest:(NSURLRequest *)request delegate:(id)delegate usesCache:(BOOL)usesCacheFlag maxContentLength:(long long)maxContentLength startImmediately:(BOOL)startImmediately connectionProperties:(NSDictionary *)connectionProperties;
 @end
@@ -171,17 +164,13 @@
 
     d->m_storageSession = d->m_context->storageSession().platformSession();
 
-    ASSERT(!d->m_proxy);
-    d->m_proxy.adoptNS(wkCreateNSURLConnectionDelegateProxy());
-    [static_cast<WebCoreNSURLConnectionDelegateProxy*>(d->m_proxy.get()) setDelegate:ResourceHandle::delegate()];
-
     // FIXME: Do not use the sync version of shouldUseCredentialStorage when the client returns true from usesAsyncCallbacks.
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
     d->m_needsSiteSpecificQuirks = d->m_context->needsSiteSpecificQuirks();
 
     createNSURLConnection(
-        d->m_proxy.get(),
+        ResourceHandle::delegate(),
         shouldUseCredentialStorage,
         d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled());
 
@@ -274,20 +263,10 @@
 {
     if (!d->m_delegate)
         return;
-    if (d->m_proxy)
-        [d->m_proxy.get() setDelegate:nil];
     [d->m_delegate.get() detachHandle];
     d->m_delegate = nil;
 }
 
-id ResourceHandle::releaseProxy()
-{
-    id proxy = [[d->m_proxy.get() retain] autorelease];
-    d->m_proxy = nil;
-    [proxy setDelegate:nil];
-    return proxy;
-}
-
 NSURLConnection *ResourceHandle::connection() const
 {
     return d->m_connection.get();
@@ -322,7 +301,7 @@
     }
 
     handle->createNSURLConnection(
-        handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
+        handle->delegate(),
         storedCredentials == AllowStoredCredentials,
         handle->shouldContentSniff() || context->localFileContentSniffingEnabled());
 

Modified: trunk/Source/WebKit/mac/ChangeLog (147475 => 147476)


--- trunk/Source/WebKit/mac/ChangeLog	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-04-02 18:36:35 UTC (rev 147476)
@@ -1,3 +1,14 @@
+2013-04-02  Alexey Proskuryakov  <[email protected]>
+
+        <rdar://problem/13551119> [WK2] Crashes in NetworkProcess when canceling loads
+        https://bugs.webkit.org/show_bug.cgi?id=113803
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::convertMainResourceLoadToDownload):
+        Just pass nil instead of proxy.
+
 2013-04-01  Ryosuke Niwa  <[email protected]>
 
         WebKit/mac shouldn't have code for Mac 10.5 and earlier

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (147475 => 147476)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-04-02 18:36:35 UTC (rev 147476)
@@ -290,15 +290,12 @@
     handle->releaseConnectionForDownload();
     CFRelease(connection);
 #else
-    id proxy = handle->releaseProxy();
-    ASSERT(proxy);
-    
     WebView *webView = getWebView(m_webFrame.get());
     [WebDownload _downloadWithLoadingConnection:handle->connection()
                                                                 request:request.nsURLRequest(UpdateHTTPBody)
                                                                response:response.nsURLResponse()
                                                                delegate:[webView downloadDelegate]
-                                                                  proxy:proxy];
+                                                                  proxy:nil];
 #endif
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (147475 => 147476)


--- trunk/Source/WebKit2/ChangeLog	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-02 18:36:35 UTC (rev 147476)
@@ -1,3 +1,13 @@
+2013-04-02  Alexey Proskuryakov  <[email protected]>
+
+        <rdar://problem/13551119> [WK2] Crashes in NetworkProcess when canceling loads
+        https://bugs.webkit.org/show_bug.cgi?id=113803
+
+        Reviewed by Darin Adler.
+
+        * Shared/Downloads/mac/DownloadMac.mm: (WebKit::Download::startWithHandle):
+        Just pass nil instead of proxy.
+
 2013-04-02  Mikhail Pozdnyakov  <[email protected]>
 
         [WK2] Remove repeating code in declaration of WK2 API classes

Modified: trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm (147475 => 147476)


--- trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm	2013-04-02 18:35:42 UTC (rev 147475)
+++ trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm	2013-04-02 18:36:35 UTC (rev 147476)
@@ -70,15 +70,12 @@
     ASSERT(!m_nsURLDownload);
     ASSERT(!m_delegate);
 
-    id proxy = handle->releaseProxy();
-    ASSERT(proxy);
-
     m_delegate.adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
     m_nsURLDownload = [NSURLDownload _downloadWithLoadingConnection:handle->connection()
                                                             request:m_request.nsURLRequest(UpdateHTTPBody)
                                                            response:response.nsURLResponse()
                                                             delegate:m_delegate.get()
-                                                               proxy:proxy];
+                                                               proxy:nil];
 
     // FIXME: Allow this to be changed by the client.
     [m_nsURLDownload.get() setDeletesFileUponFailure:NO];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to