Title: [257876] trunk
Revision
257876
Author
achristen...@apple.com
Date
2020-03-04 13:35:08 -0800 (Wed, 04 Mar 2020)

Log Message

callAsyncJavaScript with an invalid parameter and no completionHandler should not crash
https://bugs.webkit.org/show_bug.cgi?id=208593

Reviewed by Brady Eidson.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257875 => 257876)


--- trunk/Source/WebKit/ChangeLog	2020-03-04 21:26:22 UTC (rev 257875)
+++ trunk/Source/WebKit/ChangeLog	2020-03-04 21:35:08 UTC (rev 257876)
@@ -1,3 +1,13 @@
+2020-03-04  Alex Christensen  <achristen...@webkit.org>
+
+        callAsyncJavaScript with an invalid parameter and no completionHandler should not crash
+        https://bugs.webkit.org/show_bug.cgi?id=208593
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):
+
 2020-03-04  Per Arne Vollan  <pvol...@apple.com>
 
         [Cocoa] Add enable flag to disable direct mode for preferences

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (257875 => 257876)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-03-04 21:26:22 UTC (rev 257875)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-03-04 21:35:08 UTC (rev 257876)
@@ -904,7 +904,7 @@
         argumentsMap->set(key, *wireBytes);
     }
 
-    if (errorMessage) {
+    if (errorMessage && handler) {
         RetainPtr<NSMutableDictionary> userInfo = adoptNS([[NSMutableDictionary alloc] init]);
 
         [userInfo setObject:localizedDescriptionForErrorCode(WKErrorJavaScriptExceptionOccurred) forKey:NSLocalizedDescriptionKey];

Modified: trunk/Tools/ChangeLog (257875 => 257876)


--- trunk/Tools/ChangeLog	2020-03-04 21:26:22 UTC (rev 257875)
+++ trunk/Tools/ChangeLog	2020-03-04 21:35:08 UTC (rev 257876)
@@ -1,5 +1,15 @@
 2020-03-04  Alex Christensen  <achristen...@webkit.org>
 
+        callAsyncJavaScript with an invalid parameter and no completionHandler should not crash
+        https://bugs.webkit.org/show_bug.cgi?id=208593
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
+        (TestWebKitAPI::TEST):
+
+2020-03-04  Alex Christensen  <achristen...@webkit.org>
+
         WKWebView's frames accessor should return a traversable type
         https://bugs.webkit.org/show_bug.cgi?id=208591
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm (257875 => 257876)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm	2020-03-04 21:26:22 UTC (rev 257875)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm	2020-03-04 21:35:08 UTC (rev 257876)
@@ -183,6 +183,8 @@
 {
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
 
+    [webView callAsyncJavaScript:@"shouldn't crash" arguments:@{ @"invalidparameter" : webView.get() } inContentWorld:WKContentWorld.pageWorld completionHandler:nil];
+
     NSString *functionBody = @"return new Promise(function(resolve, reject) { setTimeout(function(){ resolve(42) }, 0); })";
 
     bool done = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to