REGRESSION: API test failure: WKWebView.LocalStorageClear
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2016 01:57:24 +0000 (01:57 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2016 01:57:24 +0000 (01:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166032
<rdar://problem/29758423>

Reviewed by Simon Fraser.

Add an @autoreleasepool around the code that allocates then clears the WKWebView,
to ensure that the view is destroyed before the callback fires.

* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
(TEST):

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm

index 38e5af5..00f4a65 100644 (file)
@@ -1,3 +1,17 @@
+2016-12-21  Alexey Proskuryakov  <ap@apple.com>
+
+        REGRESSION: API test failure: WKWebView.LocalStorageClear
+        https://bugs.webkit.org/show_bug.cgi?id=166032
+        <rdar://problem/29758423>
+
+        Reviewed by Simon Fraser.
+
+        Add an @autoreleasepool around the code that allocates then clears the WKWebView, 
+        to ensure that the view is destroyed before the callback fires.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
+        (TEST):
+
 2016-12-21  Saam Barati  <sbarati@apple.com>
 
         WebAssembly: Import spec tests
 2016-12-21  Saam Barati  <sbarati@apple.com>
 
         WebAssembly: Import spec tests
index 07f2e7d..eab87e0 100644 (file)
@@ -61,15 +61,17 @@ TEST(WKWebView, LocalStorageClear)
     [configuration _setNeedsStorageAccessFromFileURLsQuirk:NO];
     [configuration _setAllowUniversalAccessFromFileURLs:YES];
 
     [configuration _setNeedsStorageAccessFromFileURLsQuirk:NO];
     [configuration _setAllowUniversalAccessFromFileURLs:YES];
 
-    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    @autoreleasepool {
+        RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
 
 
-    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"LocalStorageClear" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
-    [webView loadRequest:request];
+        NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"LocalStorageClear" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+        [webView loadRequest:request];
 
 
-    TestWebKitAPI::Util::run(&readyToContinue);
-    readyToContinue = false;
+        TestWebKitAPI::Util::run(&readyToContinue);
+        readyToContinue = false;
 
 
-    webView = nil;
+        webView = nil;
+    }
 
     NSString *dbPath = [@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/file__0.localstorage" stringByExpandingTildeInPath];
     NSString *dbSHMPath = [@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/file__0.localstorage-shm" stringByExpandingTildeInPath];
 
     NSString *dbPath = [@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/file__0.localstorage" stringByExpandingTildeInPath];
     NSString *dbSHMPath = [@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/file__0.localstorage-shm" stringByExpandingTildeInPath];