Title: [210050] trunk/Tools
Revision
210050
Author
[email protected]
Date
2016-12-20 18:17:51 -0800 (Tue, 20 Dec 2016)

Log Message

REGRESSION: API test failure: WKWebView.EvaluateJavaScriptBlockCrash
https://bugs.webkit.org/show_bug.cgi?id=166031

Reviewed by Tim Horton.

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/WKWebViewEvaluateJavaScript.mm:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (210049 => 210050)


--- trunk/Tools/ChangeLog	2016-12-21 02:06:12 UTC (rev 210049)
+++ trunk/Tools/ChangeLog	2016-12-21 02:17:51 UTC (rev 210050)
@@ -1,3 +1,15 @@
+2016-12-20  Simon Fraser  <[email protected]>
+
+        REGRESSION: API test failure: WKWebView.EvaluateJavaScriptBlockCrash
+        https://bugs.webkit.org/show_bug.cgi?id=166031
+
+        Reviewed by Tim Horton.
+        
+        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/WKWebViewEvaluateJavaScript.mm:
+
 2016-12-20  Megan Gardner  <[email protected]>
 
         Throw Exception when test doesn't clean up HID Events properly

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm (210049 => 210050)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm	2016-12-21 02:06:12 UTC (rev 210049)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm	2016-12-21 02:17:51 UTC (rev 210050)
@@ -39,24 +39,26 @@
 
 TEST(WKWebView, EvaluateJavaScriptBlockCrash)
 {
-    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    @autoreleasepool {
+        RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
 
-    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
-    [webView loadRequest:request];
+        NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+        [webView loadRequest:request];
 
-    [webView evaluateJavaScript:@"" completionHandler:^(id result, NSError *error) {
-        // NOTE: By referencing the request here, we convert the block into a stack block rather than a global block and thus allow the copying of the block
-        // in evaluateJavaScript to be meaningful.
-        (void)request;
-        
-        EXPECT_NULL(result);
-        EXPECT_NOT_NULL(error);
+        [webView evaluateJavaScript:@"" completionHandler:^(id result, NSError *error) {
+            // NOTE: By referencing the request here, we convert the block into a stack block rather than a global block and thus allow the copying of the block
+            // in evaluateJavaScript to be meaningful.
+            (void)request;
+            
+            EXPECT_NULL(result);
+            EXPECT_NOT_NULL(error);
 
-        isDone = true;
-    }];
+            isDone = true;
+        }];
 
-    // Force the WKWebView to be destroyed to allow evaluateJavaScript's completion handler to be called with an error.
-    webView = nullptr;
+        // Force the WKWebView to be destroyed to allow evaluateJavaScript's completion handler to be called with an error.
+        webView = nullptr;
+    }
 
     isDone = false;
     TestWebKitAPI::Util::run(&isDone);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to