Title: [280325] trunk
- Revision
- 280325
- Author
- [email protected]
- Date
- 2021-07-26 16:58:23 -0700 (Mon, 26 Jul 2021)
Log Message
WKUserContentController.removeAllScriptMessageHandlers() doesn't release the message handlers
https://bugs.webkit.org/show_bug.cgi?id=228271
Patch by Alex Christensen <[email protected]> on 2021-07-26
Reviewed by Sihui Liu.
Source/WebKit:
Covered by an API test.
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (280324 => 280325)
--- trunk/Source/WebKit/ChangeLog 2021-07-26 23:55:51 UTC (rev 280324)
+++ trunk/Source/WebKit/ChangeLog 2021-07-26 23:58:23 UTC (rev 280325)
@@ -1,3 +1,15 @@
+2021-07-26 Alex Christensen <[email protected]>
+
+ WKUserContentController.removeAllScriptMessageHandlers() doesn't release the message handlers
+ https://bugs.webkit.org/show_bug.cgi?id=228271
+
+ Reviewed by Sihui Liu.
+
+ Covered by an API test.
+
+ * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+ (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
+
2021-07-26 Per Arne <[email protected]>
The layout test fast/images/heic-as-background-image.html is a constant failure
Modified: trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp (280324 => 280325)
--- trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp 2021-07-26 23:55:51 UTC (rev 280324)
+++ trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp 2021-07-26 23:58:23 UTC (rev 280325)
@@ -318,13 +318,8 @@
for (auto& process : m_processes)
process.send(Messages::WebUserContentController::RemoveAllUserScriptMessageHandlersForWorlds({ world.identifier() }), identifier());
- unsigned numberRemoved = 0;
m_scriptMessageHandlers.removeIf([&](auto& entry) {
- if (entry.value->world().identifier() == world.identifier()) {
- ++numberRemoved;
- return true;
- }
- return false;
+ return entry.value->world().identifier() == world.identifier();
});
}
@@ -332,6 +327,8 @@
{
for (auto& process : m_processes)
process.send(Messages::WebUserContentController::RemoveAllUserScriptMessageHandlers(), identifier());
+
+ m_scriptMessageHandlers.clear();
}
void WebUserContentControllerProxy::didPostMessage(WebPageProxyIdentifier pageProxyID, FrameInfoData&& frameInfoData, uint64_t messageHandlerID, const IPC::DataReference& dataReference, Messages::WebUserContentControllerProxy::DidPostMessage::AsyncReply&& reply)
Modified: trunk/Tools/ChangeLog (280324 => 280325)
--- trunk/Tools/ChangeLog 2021-07-26 23:55:51 UTC (rev 280324)
+++ trunk/Tools/ChangeLog 2021-07-26 23:58:23 UTC (rev 280325)
@@ -1,3 +1,13 @@
+2021-07-26 Alex Christensen <[email protected]>
+
+ WKUserContentController.removeAllScriptMessageHandlers() doesn't release the message handlers
+ https://bugs.webkit.org/show_bug.cgi?id=228271
+
+ Reviewed by Sihui Liu.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+ (TEST):
+
2021-07-26 Kate Cheney <[email protected]>
ServiceWorkerRegistration.unregister method fails in WKWebView
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm (280324 => 280325)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2021-07-26 23:55:51 UTC (rev 280324)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2021-07-26 23:58:23 UTC (rev 280325)
@@ -44,6 +44,7 @@
#import <WebKit/_WKUserStyleSheet.h>
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
+#import <wtf/WeakObjCPtr.h>
static bool isDoneWithNavigation;
@@ -1236,3 +1237,16 @@
TestWebKitAPI::Util::run(&done);
done = false;
}
+
+TEST(WKUserContentController, RemoveAllScriptMessageHandlers)
+{
+ WeakObjCPtr<ScriptMessageHandler> weakHandler;
+ auto handler = adoptNS([ScriptMessageHandler new]);
+ weakHandler = handler.get();
+ auto controller = adoptNS([WKUserContentController new]);
+ [controller addScriptMessageHandler:handler.get() name:@"testname"];
+ handler = nullptr;
+ EXPECT_NOT_NULL(weakHandler.get());
+ [controller removeAllScriptMessageHandlers];
+ EXPECT_NULL(weakHandler.get());
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes