Title: [278992] trunk
- Revision
- 278992
- Author
- [email protected]
- Date
- 2021-06-17 09:52:19 -0700 (Thu, 17 Jun 2021)
Log Message
WKScriptMessageHandlerWithReply should raise an exception if replyHandler is called twice
https://bugs.webkit.org/show_bug.cgi?id=226863
Reviewed by Chris Dumez.
Source/WebKit:
We currently dereference null inside CompletionHandlerWithFinalizer.
This makes it more obvious what is going on.
Related to rdar://78865409 but not solving it.
* UIProcess/API/Cocoa/WKUserContentController.mm:
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
(-[AsyncScriptMessageHandler userContentController:didReceiveScriptMessage:replyHandler:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (278991 => 278992)
--- trunk/Source/WebKit/ChangeLog 2021-06-17 16:36:37 UTC (rev 278991)
+++ trunk/Source/WebKit/ChangeLog 2021-06-17 16:52:19 UTC (rev 278992)
@@ -1,3 +1,16 @@
+2021-06-17 Alex Christensen <[email protected]>
+
+ WKScriptMessageHandlerWithReply should raise an exception if replyHandler is called twice
+ https://bugs.webkit.org/show_bug.cgi?id=226863
+
+ Reviewed by Chris Dumez.
+
+ We currently dereference null inside CompletionHandlerWithFinalizer.
+ This makes it more obvious what is going on.
+ Related to rdar://78865409 but not solving it.
+
+ * UIProcess/API/Cocoa/WKUserContentController.mm:
+
2021-06-17 Per Arne <[email protected]>
[macOS] Close open connections
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.mm (278991 => 278992)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.mm 2021-06-17 16:36:37 UTC (rev 278991)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.mm 2021-06-17 16:52:19 UTC (rev 278992)
@@ -182,6 +182,9 @@
auto message = adoptNS([[WKScriptMessage alloc] _initWithBody:body webView:webView.get() frameInfo:frameInfo.get() name:m_name.get() world:wrapper(world)]);
[(id<WKScriptMessageHandlerWithReply>)m_handler.get() userContentController:m_controller.get() didReceiveScriptMessage:message.get() replyHandler:^(id result, NSString *errorMessage) {
+ if (!handler)
+ [NSException raise:NSInternalInconsistencyException format:@"replyHandler passed to userContentController:didReceiveScriptMessage:replyHandler: should not be called twice"];
+
if (errorMessage) {
handler(nullptr, errorMessage);
return;
Modified: trunk/Tools/ChangeLog (278991 => 278992)
--- trunk/Tools/ChangeLog 2021-06-17 16:36:37 UTC (rev 278991)
+++ trunk/Tools/ChangeLog 2021-06-17 16:52:19 UTC (rev 278992)
@@ -1,3 +1,13 @@
+2021-06-17 Alex Christensen <[email protected]>
+
+ WKScriptMessageHandlerWithReply should raise an exception if replyHandler is called twice
+ https://bugs.webkit.org/show_bug.cgi?id=226863
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+ (-[AsyncScriptMessageHandler userContentController:didReceiveScriptMessage:replyHandler:]):
+
2021-06-17 Eric Carlson <[email protected]>
[Mac EWS] TestWebKitAPI.WebKit.AudioBufferSize is flaky timing out on EWS
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm (278991 => 278992)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2021-06-17 16:36:37 UTC (rev 278991)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2021-06-17 16:52:19 UTC (rev 278992)
@@ -979,6 +979,13 @@
}
if ([message.body isEqualToString:@"Undefined"]) {
replyHandler(nil, nil);
+ bool caught = false;
+ @try {
+ replyHandler(nil, nil);
+ } @catch (NSException *exception) {
+ caught = true;
+ }
+ EXPECT_TRUE(caught);
return;
}
if ([message.body isEqualToString:@"Do nothing"]) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes