Title: [218810] trunk/Tools
Revision
218810
Author
[email protected]
Date
2017-06-26 10:48:36 -0700 (Mon, 26 Jun 2017)

Log Message

[TestWebKitAPI] REGRESSION (r218750): Fix leak of NSURLResponse in WKURLSchemeHandler-1.mm
<https://webkit.org/b/173836>

Reviewed by Brady Eidson.

* TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm:
(-[RedirectSchemeHandler webView:startURLSchemeTask:]): Use
adoptNS() to fix the leak.  Also use auto/adoptNS() for other
objects in this test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (218809 => 218810)


--- trunk/Tools/ChangeLog	2017-06-26 16:45:34 UTC (rev 218809)
+++ trunk/Tools/ChangeLog	2017-06-26 17:48:36 UTC (rev 218810)
@@ -1,3 +1,15 @@
+2017-06-26  David Kilzer  <[email protected]>
+
+        [TestWebKitAPI] REGRESSION (r218750): Fix leak of NSURLResponse in WKURLSchemeHandler-1.mm
+        <https://webkit.org/b/173836>
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm:
+        (-[RedirectSchemeHandler webView:startURLSchemeTask:]): Use
+        adoptNS() to fix the leak.  Also use auto/adoptNS() for other
+        objects in this test.
+
 2017-06-26  Joanmarie Diggs  <[email protected]>
 
         [ATK] Add support for aria-details and aria-errormessage

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm (218809 => 218810)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm	2017-06-26 16:45:34 UTC (rev 218809)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm	2017-06-26 17:48:36 UTC (rev 218810)
@@ -203,13 +203,14 @@
 - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
 {
     ASSERT_STREQ(task.request.URL.absoluteString.UTF8String, "testing:///initial");
-    NSURLResponse *response = [[[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:nil expectedContentLength:0 textEncodingName:nil] autorelease];
-    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"testing:///redirected"]];
-    [(id<WKURLSchemeTaskPrivate>)task _didPerformRedirection:response newRequest:request];
+    auto redirectResponse = adoptNS([[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:nil expectedContentLength:0 textEncodingName:nil]);
+    auto request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"testing:///redirected"]]);
+    [(id<WKURLSchemeTaskPrivate>)task _didPerformRedirection:redirectResponse.get() newRequest:request.get()];
     ASSERT_FALSE(receivedRedirect);
     ASSERT_STREQ(task.request.URL.absoluteString.UTF8String, "testing:///redirected");
     NSString *html = @"<script>window.webkit.messageHandlers.testHandler.postMessage('Document URL: ' + document.URL);</script>";
-    [task didReceiveResponse:[[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:html.length textEncodingName:nil]];
+    auto finalResponse = adoptNS([[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:html.length textEncodingName:nil]);
+    [task didReceiveResponse:finalResponse.get()];
     [task didReceiveData:[html dataUsingEncoding:NSUTF8StringEncoding]];
     [task didFinish];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to