Title: [270790] trunk
Revision
270790
Author
[email protected]
Date
2020-12-14 11:27:33 -0800 (Mon, 14 Dec 2020)

Log Message

Remove WKDownloadDelegate.didWriteData
https://bugs.webkit.org/show_bug.cgi?id=219820

Patch by Alex Christensen <[email protected]> on 2020-12-14
Reviewed by Sam Weinig.

Source/WebKit:

API review revealed it was redundant with WKDownload.progress, which has KVO-compliant totalUnitCount and completedUnitCount.

* UIProcess/API/Cocoa/WKDownload.mm:
(-[WKDownload progress]):
* UIProcess/API/Cocoa/WKDownloadDelegate.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(-[DownloadObserver observeValueForKeyPath:ofObject:change:context:]):
(TestWebKitAPI::mutateFile):
* TestWebKitAPI/cocoa/TestDownloadDelegate.h:
* TestWebKitAPI/cocoa/TestDownloadDelegate.mm:
(-[TestDownloadDelegate download:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (270789 => 270790)


--- trunk/Source/WebKit/ChangeLog	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Source/WebKit/ChangeLog	2020-12-14 19:27:33 UTC (rev 270790)
@@ -1,3 +1,16 @@
+2020-12-14  Alex Christensen  <[email protected]>
+
+        Remove WKDownloadDelegate.didWriteData
+        https://bugs.webkit.org/show_bug.cgi?id=219820
+
+        Reviewed by Sam Weinig.
+
+        API review revealed it was redundant with WKDownload.progress, which has KVO-compliant totalUnitCount and completedUnitCount.
+
+        * UIProcess/API/Cocoa/WKDownload.mm:
+        (-[WKDownload progress]):
+        * UIProcess/API/Cocoa/WKDownloadDelegate.h:
+
 2020-12-14  Andy Estes  <[email protected]>
 
         [Mac] Enable `webm_format_reader` feature flag by default

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownload.mm (270789 => 270790)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownload.mm	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownload.mm	2020-12-14 19:27:33 UTC (rev 270790)
@@ -42,7 +42,6 @@
         : m_delegate(delegate)
         , m_respondsToWillPerformHTTPRedirection([delegate respondsToSelector:@selector(download:willPerformHTTPRedirection:newRequest:decisionHandler:)])
         , m_respondsToDidReceiveAuthenticationChallenge([delegate respondsToSelector:@selector(download:didReceiveAuthenticationChallenge:completionHandler:)])
-        , m_respondsToDidWriteData([delegate respondsToSelector:@selector(download:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)])
         , m_respondsToDidFinish([m_delegate respondsToSelector:@selector(downloadDidFinish:)])
         , m_respondsToDidFailWithError([delegate respondsToSelector:@selector(download:didFailWithError:resumeData:)])
     {
@@ -140,16 +139,11 @@
         }).get()];
     }
 
-    void didReceiveData(WebKit::DownloadProxy& download, uint64_t bytesWritten, uint64_t totalBytesWritten, uint64_t totalBytesExpectedToWrite) final
+    void didReceiveData(WebKit::DownloadProxy& download, uint64_t, uint64_t totalBytesWritten, uint64_t totalBytesExpectedToWrite) final
     {
         NSProgress *progress = wrapper(download).progress;
+        progress.totalUnitCount = totalBytesExpectedToWrite;
         progress.completedUnitCount = totalBytesWritten;
-        progress.totalUnitCount = totalBytesExpectedToWrite;
-
-        if (!m_delegate || !m_respondsToDidWriteData)
-            return;
-
-        [m_delegate download:wrapper(download) didWriteData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
     }
 
     void didFinish(WebKit::DownloadProxy& download) final
@@ -180,7 +174,6 @@
 
     bool m_respondsToWillPerformHTTPRedirection : 1;
     bool m_respondsToDidReceiveAuthenticationChallenge : 1;
-    bool m_respondsToDidWriteData : 1;
     bool m_respondsToDidFinish : 1;
     bool m_respondsToDidFailWithError : 1;
 };
@@ -225,7 +218,8 @@
 {
     NSProgress* downloadProgress = _download->progress();
     if (!downloadProgress) {
-        downloadProgress = [NSProgress progressWithTotalUnitCount:100];
+        constexpr auto indeterminateUnitCount = -1;
+        downloadProgress = [NSProgress progressWithTotalUnitCount:indeterminateUnitCount];
 
         downloadProgress.kind = NSProgressKindFile;
         downloadProgress.fileOperationKind = NSProgressFileOperationKindDownloading;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h (270789 => 270790)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h	2020-12-14 19:27:33 UTC (rev 270790)
@@ -82,17 +82,6 @@
  */
 - (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler;
 
-/* @abstract Invoked when the download has received and written data to the destination.
- @param download The download that has written data.
- @param bytesWritten The number of bytes written.
- @param totalBytesWritten The total number of bytes written.
- @param totalBytesExpectedToWrite The total number of bytes expected to be written.
- @discussion If this download was the result of resuming a previous download, then
- totalBytesWritten will be bytesWritten plus the number of bytes that had already been downloaded.
- If the total number of bytes is unknown, totalBytesExpectedToWrite will be -1.
- */
-- (void)download:(WKDownload *)download didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite;
-
 /* @abstract Invoked when the download has finished successfully.
  @param download The download that finished.
  */

Modified: trunk/Tools/ChangeLog (270789 => 270790)


--- trunk/Tools/ChangeLog	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Tools/ChangeLog	2020-12-14 19:27:33 UTC (rev 270790)
@@ -1,3 +1,17 @@
+2020-12-14  Alex Christensen  <[email protected]>
+
+        Remove WKDownloadDelegate.didWriteData
+        https://bugs.webkit.org/show_bug.cgi?id=219820
+
+        Reviewed by Sam Weinig.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
+        (-[DownloadObserver observeValueForKeyPath:ofObject:change:context:]):
+        (TestWebKitAPI::mutateFile):
+        * TestWebKitAPI/cocoa/TestDownloadDelegate.h:
+        * TestWebKitAPI/cocoa/TestDownloadDelegate.mm:
+        (-[TestDownloadDelegate download:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): Deleted.
+
 2020-12-14  Jonathan Bedard  <[email protected]>
 
         [webkitscmpy] Load mock repository data from json file

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm (270789 => 270790)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm	2020-12-14 19:27:33 UTC (rev 270790)
@@ -1425,6 +1425,22 @@
     TestWebKitAPI::Util::run(&isDone);
 }
 
+@interface DownloadObserver : NSObject
+@property (nonatomic, copy) void (^progressChangeCallback)(int64_t, int64_t);
+@end
+
+@implementation DownloadObserver
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *, id> *)change context:(void *)context
+{
+    if (self.progressChangeCallback) {
+        NSProgress *progress = (NSProgress *)object;
+        self.progressChangeCallback(progress.completedUnitCount, progress.totalUnitCount);
+    }
+}
+
+@end
+
 namespace TestWebKitAPI {
 
 static void checkCallbackRecord(TestDownloadDelegate *delegate, Vector<DownloadCallback> expectedCallbacks)
@@ -1462,7 +1478,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -1489,15 +1504,16 @@
         delegate.decideDestinationUsingResponse = ^(WKDownload *, NSURLResponse *, NSString *, void (^completionHandler)(NSURL *)) {
             ASSERT_NOT_REACHED();
         };
-        delegate.didWriteData = ^(WKDownload *download, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
-            EXPECT_EQ(download, retainedDownload.get());
-            EXPECT_EQ(bytesWritten + 5000, totalBytesWritten);
-            EXPECT_EQ(totalBytesExpectedToWrite, 10000);
-            EXPECT_EQ(download.progress.totalUnitCount, 10000);
-            EXPECT_EQ(download.progress.completedUnitCount, totalBytesWritten);
-            if (bytesWritten == 5000)
+
+        auto observer = adoptNS([DownloadObserver new]);
+        observer.get().progressChangeCallback = ^(int64_t bytesWritten, int64_t totalByteCount) {
+            if (bytesWritten == 10000) {
+                EXPECT_EQ(totalByteCount, 10000);
                 downloadedSecond5k = true;
+            }
         };
+        [retainedDownload.get().progress addObserver:observer.get() forKeyPath:@"completedUnitCount" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:nil];
+
         __block bool didFinish = false;
         delegate.downloadDidFinish = ^(WKDownload *download) {
             EXPECT_EQ(retainedDownload.get(), download);
@@ -1507,9 +1523,10 @@
 
         Util::run(&didFinish);
 
+        [retainedDownload.get().progress removeObserver:observer.get() forKeyPath:@"completedUnitCount" context:nil];
+
         checkResumedDownloadContents(destination);
         checkCallbackRecord(delegate, {
-            DownloadCallback::DidWriteData,
             DownloadCallback::DidFinish
         });
         EXPECT_EQ(retainedDownload.get().webView, webView.get());
@@ -1519,17 +1536,22 @@
     EXPECT_NULL(retainedDownload.get().webView);
 }
 
-static void waitForFirst5k(TestDownloadDelegate *delegate)
+static void waitForFirst5k(RetainPtr<WKDownload>& download)
 {
     __block bool downloadedFirst5k = false;
-    ASSERT(!delegate.didWriteData);
-    delegate.didWriteData = ^(WKDownload *, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
-        EXPECT_EQ(bytesWritten, totalBytesWritten);
-        EXPECT_EQ(totalBytesExpectedToWrite, 10000);
-        if (bytesWritten == 5000)
+    
+    auto observer = adoptNS([DownloadObserver new]);
+    observer.get().progressChangeCallback = ^(int64_t bytesWritten, int64_t totalByteCount) {
+        if (bytesWritten == 5000) {
+            EXPECT_EQ(totalByteCount, 10000);
             downloadedFirst5k = true;
+        }
     };
+    while (!download)
+        Util::spinRunLoop();
+    [download.get().progress addObserver:observer.get() forKeyPath:@"completedUnitCount" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:nil];
     Util::run(&downloadedFirst5k);
+    [download.get().progress removeObserver:observer.get() forKeyPath:@"completedUnitCount" context:nil];
 }
 
 TEST(WKDownload, CancelAndResume)
@@ -1550,7 +1572,7 @@
     };
 
     [webView loadRequest:server.request()];
-    waitForFirst5k(delegate);
+    waitForFirst5k(retainedDownload);
 
     __block RetainPtr<NSData> retainedResumeData;
     [retainedDownload cancel:^(NSData *resumeData) {
@@ -1565,7 +1587,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData
     });
 }
 
@@ -1572,8 +1593,9 @@
 TEST(WKDownload, FailAndResume)
 {
     auto delegate = [[TestDownloadDelegate new] autorelease];
+    RetainPtr<WKDownload> retainedDownload;
     auto server = downloadTestServer(IncludeETag::Yes, [&] (TestWebKitAPI::Connection connection) {
-        waitForFirst5k(delegate);
+        waitForFirst5k(retainedDownload);
         connection.terminate();
     });
     NSURL *expectedDownloadFile = tempFileThatDoesNotExist();
@@ -1580,9 +1602,8 @@
     auto webView = [[WKWebView new] autorelease];
     webView.navigationDelegate = delegate;
 
-    __block RetainPtr<WKDownload> retainedDownload;
-    __block RetainPtr<NSData> retainedResumeData;
-    delegate.navigationResponseDidBecomeDownload = ^(WKWebView *, WKNavigationResponse *, WKDownload *download) {
+    RetainPtr<NSData> retainedResumeData;
+    delegate.navigationResponseDidBecomeDownload = makeBlockPtr([&](WKWebView *, WKNavigationResponse *, WKDownload *download) {
         retainedDownload = download;
         download.delegate = delegate;
         delegate.decideDestinationUsingResponse = ^(WKDownload *, NSURLResponse *, NSString *, void (^completionHandler)(NSURL *)) {
@@ -1594,7 +1615,7 @@
             EXPECT_EQ(error.code, NSURLErrorNetworkConnectionLost);
             retainedResumeData = resumeData;
         };
-    };
+    }).get();
 
     [webView loadRequest:server.request()];
 
@@ -1606,7 +1627,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFailWithError,
     });
 }
@@ -1628,7 +1648,7 @@
         };
     };
     [webView loadRequest:server.request()];
-    waitForFirst5k(delegate);
+    waitForFirst5k(retainedDownload);
 
     __block bool done = false;
     [retainedDownload cancel:^(NSData *resumeData) {
@@ -1642,7 +1662,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData
     });
 }
 
@@ -1649,8 +1668,9 @@
 TEST(WKDownload, FailNoResumeData)
 {
     auto delegate = [[TestDownloadDelegate new] autorelease];
+    RetainPtr<WKDownload> retainedDownload;
     auto server = downloadTestServer(IncludeETag::No, [&] (TestWebKitAPI::Connection connection) {
-        waitForFirst5k(delegate);
+        waitForFirst5k(retainedDownload);
         connection.terminate();
     });
     NSURL *expectedDownloadFile = tempFileThatDoesNotExist();
@@ -1657,19 +1677,20 @@
     auto webView = [[WKWebView new] autorelease];
     webView.navigationDelegate = delegate;
 
-    __block bool done = false;
-    delegate.navigationResponseDidBecomeDownload = ^(WKWebView *, WKNavigationResponse *, WKDownload *download) {
+    bool done = false;
+    delegate.navigationResponseDidBecomeDownload = makeBlockPtr([&](WKWebView *, WKNavigationResponse *, WKDownload *download) {
+        retainedDownload = download;
         download.delegate = delegate;
         delegate.decideDestinationUsingResponse = ^(WKDownload *, NSURLResponse *, NSString *, void (^completionHandler)(NSURL *)) {
             completionHandler(expectedDownloadFile);
         };
-        delegate.didFailWithError = ^(WKDownload *, NSError *error, NSData *resumeData) {
+        delegate.didFailWithError = makeBlockPtr([&](WKDownload *, NSError *error, NSData *resumeData) {
             EXPECT_WK_STREQ(error.domain, NSURLErrorDomain);
             EXPECT_EQ(error.code, NSURLErrorNetworkConnectionLost);
             EXPECT_NULL(resumeData);
             done = true;
-        };
-    };
+        }).get();
+    }).get();
     [webView loadRequest:server.request()];
     Util::run(&done);
     checkFileContents(expectedDownloadFile, longString<5000>('a'));
@@ -1678,7 +1699,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFailWithError
     });
 }
@@ -1759,7 +1779,6 @@
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
         DownloadCallback::DidFailWithError,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -1782,8 +1801,7 @@
     };
 
     [webView loadRequest:serverRequest];
-    waitForFirst5k(delegate);
-    delegate.didWriteData = nil;
+    waitForFirst5k(retainedDownload);
 
     __block RetainPtr<NSData> retainedResumeData;
     [retainedDownload cancel:^(NSData *resumeData) {
@@ -1810,7 +1828,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -1940,7 +1957,7 @@
         };
     };
     [webView loadRequest:server.request()];
-    waitForFirst5k(delegate);
+    waitForFirst5k(retainedDownload);
 
     checkFileContents(expectedDownloadFile, longString<5000>('a'));
 
@@ -1975,7 +1992,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFailWithError
     });
 }
@@ -1993,23 +2009,25 @@
     webView.navigationDelegate = delegate;
 
     __block bool done = false;
+    auto observer = adoptNS([DownloadObserver new]);
+    observer.get().progressChangeCallback = ^(int64_t bytesWritten, int64_t totalByteCount) {
+        EXPECT_EQ(totalByteCount, -1);
+        if (bytesWritten == 5000)
+            done = true;
+    };
+
+    __block RetainPtr<WKDownload> retainedDownload;
     delegate.navigationResponseDidBecomeDownload = ^(WKWebView *, WKNavigationResponse *, WKDownload *download) {
         download.delegate = delegate;
+        retainedDownload = download;
         delegate.decideDestinationUsingResponse = ^(WKDownload *, NSURLResponse *, NSString *, void (^completionHandler)(NSURL *)) {
             completionHandler(expectedDownloadFile);
         };
-        delegate.didWriteData = ^(WKDownload *download, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
-            EXPECT_EQ(download.progress.totalUnitCount, -1);
-            EXPECT_EQ(download.progress.completedUnitCount, totalBytesWritten);
-            if (bytesWritten != 5000)
-                return;
-            EXPECT_EQ(totalBytesWritten, 5000);
-            EXPECT_EQ(totalBytesExpectedToWrite, -1);
-            done = true;
-        };
+        [download.progress addObserver:observer.get() forKeyPath:@"completedUnitCount" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:nil];
     };
     [webView loadRequest:server.request()];
     Util::run(&done);
+    [retainedDownload.get().progress removeObserver:observer.get() forKeyPath:@"completedUnitCount" context:nil];
     checkFileContents(expectedDownloadFile, longString<5000>('a'));
 
     checkCallbackRecord(delegate, {
@@ -2017,7 +2035,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData
     });
 }
 
@@ -2094,7 +2111,6 @@
     checkCallbackRecord(delegate, {
         DownloadCallback::WillRedirect,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -2183,7 +2199,6 @@
 
     checkCallbackRecord(delegate, {
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish,
     });
 }
@@ -2196,7 +2211,9 @@
     auto webView = [[WKWebView new] autorelease];
     webView.navigationDelegate = delegate;
 
+    __block RetainPtr<WKDownload> retainedDownload;
     delegate.navigationResponseDidBecomeDownload = ^(WKWebView *, WKNavigationResponse *, WKDownload *download) {
+        retainedDownload = download;
         download.delegate = delegate;
         delegate.decideDestinationUsingResponse = ^(WKDownload *, NSURLResponse *, NSString *, void (^completionHandler)(NSURL *)) {
             completionHandler(expectedDownloadFile);
@@ -2203,7 +2220,7 @@
         };
     };
     [webView loadRequest:server.request()];
-    waitForFirst5k(delegate);
+    waitForFirst5k(retainedDownload);
     
     __block bool terminated = false;
     delegate.didFailWithError = ^(WKDownload *, NSError *error, NSData *) {
@@ -2218,7 +2235,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFailWithError
     });
 }
@@ -2250,7 +2266,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -2398,7 +2413,6 @@
     checkCallbackRecord(delegate, {
         DownloadCallback::AuthenticationChallenge,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }
@@ -2504,7 +2518,6 @@
         DownloadCallback::NavigationResponse,
         DownloadCallback::NavigationResponseBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 
@@ -2513,7 +2526,6 @@
         DownloadCallback::NavigationAction,
         DownloadCallback::NavigationActionBecameDownload,
         DownloadCallback::DecideDestination,
-        DownloadCallback::DidWriteData,
         DownloadCallback::DidFinish
     });
 }

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.h (270789 => 270790)


--- trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.h	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.h	2020-12-14 19:27:33 UTC (rev 270790)
@@ -29,7 +29,6 @@
     WillRedirect,
     AuthenticationChallenge,
     DecideDestination,
-    DidWriteData,
     DidFinish,
     DidFailWithError,
     NavigationActionBecameDownload,
@@ -43,7 +42,6 @@
 @property (nonatomic, copy) void (^willPerformHTTPRedirection)(WKDownload *, NSHTTPURLResponse *, NSURLRequest *, void (^)(WKDownloadRedirectPolicy));
 @property (nonatomic, copy) void (^didReceiveAuthenticationChallenge)(WKDownload *, NSURLAuthenticationChallenge *, void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential*));
 @property (nonatomic, copy) void (^decideDestinationUsingResponse)(WKDownload *, NSURLResponse *, NSString *, void (^)(NSURL *));
-@property (nonatomic, copy) void (^didWriteData)(WKDownload *, int64_t, int64_t, int64_t);
 @property (nonatomic, copy) void (^downloadDidFinish)(WKDownload *);
 @property (nonatomic, copy) void (^didFailWithError)(WKDownload *, NSError *, NSData *);
 

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.mm (270789 => 270790)


--- trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.mm	2020-12-14 19:20:26 UTC (rev 270789)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.mm	2020-12-14 19:27:33 UTC (rev 270790)
@@ -48,16 +48,6 @@
     _decideDestinationUsingResponse(download, response, suggestedFilename, completionHandler);
 }
 
-- (void)download:(WKDownload *)download didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
-{
-    // didWriteData is called a nondeterministic number of times, so only record once in a series.
-    if (_callbackRecord.isEmpty() || _callbackRecord.last() != DownloadCallback::DidWriteData)
-        _callbackRecord.append(DownloadCallback::DidWriteData);
-
-    if (_didWriteData)
-        _didWriteData(download, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
-}
-
 - (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential*))completionHandler
 {
     _callbackRecord.append(DownloadCallback::AuthenticationChallenge);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to