Title: [210341] branches/safari-603-branch/Tools
Revision
210341
Author
matthew_han...@apple.com
Date
2017-01-05 09:08:58 -0800 (Thu, 05 Jan 2017)

Log Message

Merge r210050. rdar://problem/29758419

Modified Paths

Diff

Modified: branches/safari-603-branch/Tools/ChangeLog (210340 => 210341)


--- branches/safari-603-branch/Tools/ChangeLog	2017-01-05 17:08:56 UTC (rev 210340)
+++ branches/safari-603-branch/Tools/ChangeLog	2017-01-05 17:08:58 UTC (rev 210341)
@@ -1,3 +1,19 @@
+2017-01-05  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r210050. rdar://problem/29758419
+
+    2016-12-20  Simon Fraser  <simon.fra...@apple.com>
+
+            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  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r210031.

Modified: branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm (210340 => 210341)


--- branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm	2017-01-05 17:08:56 UTC (rev 210340)
+++ branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm	2017-01-05 17:08:58 UTC (rev 210341)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to