WKWebView._setResourceLoadDelegate should clear the WebPageProxy's ResourceLoadClient
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2020 22:37:44 +0000 (22:37 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2020 22:37:44 +0000 (22:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205887

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setResourceLoadDelegate:]):
WebPageProxy::setResourceLoadClient has some special logic to possibly clear a bit in the web process that will reduce IPCs.
This is a small oversight in my original implementation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@256646 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

index f266f1e..173e91e 100644 (file)
@@ -1,3 +1,13 @@
+2020-02-14  Alex Christensen  <achristensen@webkit.org>
+
+        WKWebView._setResourceLoadDelegate should clear the WebPageProxy's ResourceLoadClient
+        https://bugs.webkit.org/show_bug.cgi?id=205887
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _setResourceLoadDelegate:]):
+        WebPageProxy::setResourceLoadClient has some special logic to possibly clear a bit in the web process that will reduce IPCs.
+        This is a small oversight in my original implementation.
+
 2020-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, fix the iOS 13.1 build after r256520
index 0752c41..e76880b 100644 (file)
@@ -684,8 +684,13 @@ static void hardwareKeyboardAvailabilityChangedCallback(CFNotificationCenterRef,
 
 - (void)_setResourceLoadDelegate:(id<_WKResourceLoadDelegate>)delegate
 {
-    _page->setResourceLoadClient(_resourceLoadDelegate->createResourceLoadClient());
-    _resourceLoadDelegate->setDelegate(delegate);
+    if (delegate) {
+        _page->setResourceLoadClient(_resourceLoadDelegate->createResourceLoadClient());
+        _resourceLoadDelegate->setDelegate(delegate);
+    } else {
+        _page->setResourceLoadClient(nullptr);
+        _resourceLoadDelegate->setDelegate(nil);
+    }
 }
 
 - (WKNavigation *)loadRequest:(NSURLRequest *)request