Regression(r222308): new API tests are failing for !NETWORK_SESSION
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 22:08:39 +0000 (22:08 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 22:08:39 +0000 (22:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177321

Reviewed by Alex Christensen.

Source/WebKit:

When a load is redirected and then converted into a download, CFNetwork
seems to call [NSURLDownloadDelegate willSendRequest:] on the download
with a non-nil redirectResponse, which was unexpected.

To address the issue, we now ignore the willSendRequest call if the
new request's URL is the same as the redirectResponse one.

* NetworkProcess/Downloads/mac/DownloadMac.mm:
(-[WKDownloadAsDelegate download:willSendRequest:redirectResponse:]):

Tools:

Unskip API tests now that they pass everywhere.

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(TEST):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/mac/DownloadMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm

index bfc5bdc..558ad21 100644 (file)
@@ -1,5 +1,22 @@
 2017-09-21  Chris Dumez  <cdumez@apple.com>
 
+        Regression(r222308): new API tests are failing for !NETWORK_SESSION
+        https://bugs.webkit.org/show_bug.cgi?id=177321
+
+        Reviewed by Alex Christensen.
+
+        When a load is redirected and then converted into a download, CFNetwork
+        seems to call [NSURLDownloadDelegate willSendRequest:] on the download
+        with a non-nil redirectResponse, which was unexpected.
+
+        To address the issue, we now ignore the willSendRequest call if the
+        new request's URL is the same as the redirectResponse one.
+
+        * NetworkProcess/Downloads/mac/DownloadMac.mm:
+        (-[WKDownloadAsDelegate download:willSendRequest:redirectResponse:]):
+
+2017-09-21  Chris Dumez  <cdumez@apple.com>
+
         Unreviewed, drop assertion added in r222308.
 
         The assertion is hit by a couple of tests still but there is no bad effect
index 5c63f5a..52182f2 100644 (file)
@@ -209,7 +209,7 @@ static void dispatchOnMainThread(void (^block)())
 - (NSURLRequest *)download:(NSURLDownload *)download willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
 {
     dispatchOnMainThread(^ {
-        if (_download && redirectResponse)
+        if (_download && redirectResponse && ![request.URL isEqual:redirectResponse.URL])
             _download->willSendRedirectedRequest(request, redirectResponse);
     });
     return request;
index da7ae5e..1e5771a 100644 (file)
@@ -1,3 +1,15 @@
+2017-09-21  Chris Dumez  <cdumez@apple.com>
+
+        Regression(r222308): new API tests are failing for !NETWORK_SESSION
+        https://bugs.webkit.org/show_bug.cgi?id=177321
+
+        Reviewed by Alex Christensen.
+
+        Unskip API tests now that they pass everywhere.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
+        (TEST):
+
 2017-09-21  Filip Pizlo  <fpizlo@apple.com>
 
         Unreviewed, fix ability to run tests in browser.
index 7239870..d6e4252 100644 (file)
@@ -525,8 +525,7 @@ TEST(_WKDownload, RedirectedDownload)
     [TestProtocol unregister];
 }
 
-// FIXME: Re-enable once it passes on El Capitan (https://bugs.webkit.org/show_bug.cgi?id=177321).
-TEST(_WKDownload, DISABLED_RedirectedLoadConvertedToDownload)
+TEST(_WKDownload, RedirectedLoadConvertedToDownload)
 {
     [TestProtocol registerWithScheme:@"http"];
 
@@ -548,8 +547,7 @@ TEST(_WKDownload, DISABLED_RedirectedLoadConvertedToDownload)
     [TestProtocol unregister];
 }
 
-// FIXME: Re-enable once it passes on El Capitan (https://bugs.webkit.org/show_bug.cgi?id=177321).
-TEST(_WKDownload, DISABLED_RedirectedSubframeLoadConvertedToDownload)
+TEST(_WKDownload, RedirectedSubframeLoadConvertedToDownload)
 {
     [TestProtocol registerWithScheme:@"http"];