Test WebKit2CustomProtocolsTest.ProcessPoolDestroyedDuringLoading added in r219664...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jul 2017 20:34:29 +0000 (20:34 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jul 2017 20:34:29 +0000 (20:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174685

Reviewed by Andy Estes.

* TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm:
(TestWebKitAPI::TEST): Use a scoped AutodrainedPool instead of a RetainPtr<NSAutoreleasePool>.

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm

index 45b8938..147f5ff 100644 (file)
@@ -1,5 +1,15 @@
 2017-07-20  Brady Eidson  <beidson@apple.com>
 
+        Test WebKit2CustomProtocolsTest.ProcessPoolDestroyedDuringLoading added in r219664 fails on El Capitan.
+        https://bugs.webkit.org/show_bug.cgi?id=174685
+
+        Reviewed by Andy Estes.
+
+        * TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm:
+        (TestWebKitAPI::TEST): Use a scoped AutodrainedPool instead of a RetainPtr<NSAutoreleasePool>.
+
+2017-07-20  Brady Eidson  <beidson@apple.com>
+
         Deprecate WebIconDatabase in WebKitLegacy/mac.
         https://bugs.webkit.org/show_bug.cgi?id=174607
 
index a34d592..a6ee166 100644 (file)
@@ -34,6 +34,7 @@
 #import "TestProtocol.h"
 #import <WebKit/WKContextPrivate.h>
 #import <WebKit/WKProcessGroupPrivate.h>
+#import <wtf/AutodrainedPool.h>
 #import <wtf/RetainPtr.h>
 
 #if WK_API_ENABLED && PLATFORM(MAC)
@@ -170,20 +171,22 @@ TEST(WebKit2CustomProtocolsTest, ProcessPoolDestroyedDuringLoading)
 {
     [ProcessPoolDestroyedDuringLoadingProtocol registerWithScheme:@"custom"];
 
-    auto autoreleasePool = adoptNS([[NSAutoreleasePool alloc] init]);
-    auto browsingContextGroup = adoptNS([[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]);
-    auto processGroup = adoptNS([[WKProcessGroup alloc] init]);
-    auto wkView = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]);
+    {
+        AutodrainedPool pool;
+        auto browsingContextGroup = adoptNS([[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]);
+        auto processGroup = adoptNS([[WKProcessGroup alloc] init]);
+        auto wkView = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]);
     
-    [[wkView browsingContextController] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"custom:///test"]]];
+        [[wkView browsingContextController] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"custom:///test"]]];
 
-    Util::run(&isDone);
-    isDone = false;
+        Util::run(&isDone);
+        isDone = false;
 
-    processGroup = nil;
-    wkView = nil;
-    browsingContextGroup = nil;
-    autoreleasePool = nil;
+        // Instead of relying on the block going out of scope, manually release these objects in this order
+        processGroup = nil;
+        wkView = nil;
+        browsingContextGroup = nil;
+    }
 
     ASSERT(processPoolProtocolInstance);
     [processPoolProtocolInstance finishTheLoad];