Bug 245324

Summary: [GTK] http/tests/notifications/notification.html is crashing when notification permission is granted
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=245294

Description Chris Dumez 2022-09-17 15:13:10 PDT
http/tests/notifications/notification.html is crashing when notification permission is granted:
Thread 1 (Thread 0x7f8531f9b9c0 (LWP 67318)):
#0  0x00007f853b26c440 in WebKit::ShareableBitmap::data() const () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#1  0x00007f853b2d2f13 in WebKit::ShareableBitmap::createGraphicsContext() () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#2  0x00007f853b27b2c1 in IPC::encodeImage(IPC::Encoder&, WebCore::Image&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#3  0x00007f853b67d2af in unsigned long IPC::Connection::sendWithAsyncReply<Messages::NotificationManagerMessageHandler::ShowNotification, WTF::CompletionHandler<void ()> >(Messages::NotificationManagerMessageHandler::ShowNotification&&, WTF::CompletionHandler<void ()>&&, unsigned long, WTF::OptionSet<IPC::SendOption>) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#4  0x00007f853b67d3ad in WTF::Detail::CallableWrapper<WebKit::WebNotificationManager::sendNotificationMessageWithAsyncReply<Messages::NotificationManagerMessageHandler::ShowNotification>(Messages::NotificationManagerMessageHandler::ShowNotification&&, WebCore::Notification&, WebKit::WebPage*, WTF::CompletionHandler<void ()>&&)::{lambda(auto:1&, auto:2)#1}, bool, IPC::Connection&, unsigned long>::call(IPC::Connection&, unsigned long) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#5  0x00007f853b676b5c in WebKit::WebNotificationManager::show(WebCore::Notification&, WebKit::WebPage*, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#6  0x00007f853b6bf2ef in WTF::Detail::CallableWrapper<WebKit::WebNotificationClient::show(WebCore::Notification&, WTF::CompletionHandler<void ()>&&)::{lambda()#1}, void>::call() () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#7  0x00007f85388d040b in WTF::callOnMainRunLoopAndWait(WTF::Function<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.1.so.0
#8  0x00007f853b6c6d51 in WebKit::WebNotificationClient::show(WebCore::Notification&, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#9  0x00007f853c561460 in WTF::Detail::CallableWrapper<WebCore::Notification::show(WTF::CompletionHandler<void ()>&&)::{lambda(WTF::RefPtr<WebCore::NotificationResources, WTF::RawPtrTraits<WebCore::NotificationResources>, WTF::DefaultRefDerefTraits<WebCore::NotificationResources> >&&)#1}, void, WTF::RefPtr<WebCore::NotificationResources, WTF::RawPtrTraits<WebCore::NotificationResources>, WTF::DefaultRefDerefTraits<WebCore::NotificationResources> >&&>::call(WTF::RefPtr<WebCore::NotificationResources, WTF::RawPtrTraits<WebCore::NotificationResources>, WTF::DefaultRefDerefTraits<WebCore::NotificationResources> >&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#10 0x00007f853c56392f in WebCore::NotificationResourcesLoader::didFinishLoadingResource(WebCore::NotificationResourcesLoader::ResourceLoader*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#11 0x00007f853c563f12 in WebCore::NotificationResourcesLoader::ResourceLoader::didFinishLoading(WTF::ObjectIdentifier<WebCore::ResourceLoader>, WebCore::NetworkLoadMetrics const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#12 0x00007f853d1d4cc5 in WebCore::CachedResource::checkNotify(WebCore::NetworkLoadMetrics const&) [clone .part.0] () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#13 0x00007f853d1d59dc in WebCore::CachedRawResource::finishLoading(WebCore::FragmentedSharedBuffer const*, WebCore::NetworkLoadMetrics const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#14 0x00007f853d193b03 in WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#15 0x00007f853b01f233 in void IPC::handleMessage<Messages::WebResourceLoader::DidFinishResourceLoad, WebKit::WebResourceLoader, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics&&)>(IPC::Connection&, IPC::Decoder&, WebKit::WebResourceLoader*, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics&&)) [clone .isra.0] () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#16 0x00007f853b0230fc in WebKit::WebResourceLoader::didReceiveWebResourceLoaderMessage(IPC::Connection&, IPC::Decoder&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#17 0x00007f853b24bda5 in IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#18 0x00007f853b24da81 in IPC::Connection::dispatchOneIncomingMessage() () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#19 0x00007f85388e07bc in WTF::RunLoop::performWork() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.1.so.0
#20 0x00007f8538957329 in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.1.so.0
#21 0x00007f8538957dbf in WTF::RunLoop::{lambda(_GSource*, int (*)(void*), void*)#1}::_FUN(_GSource*, int (*)(void*), void*) () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.1.so.0
#22 0x00007f8534b3c294 in g_main_dispatch (context=0x564f41126240) at ../glib/gmain.c:3381
#23 g_main_context_dispatch (context=0x564f41126240) at ../glib/gmain.c:4099
#24 0x00007f8534b3c638 in g_main_context_iterate (context=0x564f41126240, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4175
#25 0x00007f8534b3c943 in g_main_loop_run (loop=0x564f41081340) at ../glib/gmain.c:4373
#26 0x00007f8538957f00 in WTF::RunLoop::run() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.1.so.0
#27 0x00007f853b73f5ce in int WebKit::AuxiliaryProcessMain<WebKit::WebProcessMainGtk>(int, char**) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.1.so.0
#28 0x00007f8534482b80 in __libc_start_main (main=0x564f403b0970 <main>, argc=4, argv=0x7ffc97fa8d08, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc97fa8cf8) at ../csu/libc-start.c:332
#29 0x0000564f403b08ae in _start () at ../sysdeps/x86_64/start.S:120
Comment 1 Michael Catanzaro 2022-09-17 15:23:56 PDT
Likely related to 253460@main
Comment 2 Chris Dumez 2022-09-17 15:26:55 PDT
You need to call `testRunner.grantWebNotificationPermission(self.origin);` at the beginning of the test to trigger this.

I am adding `testRunner.grantWebNotificationPermission(self.origin);` to testharnessreport.js in my patch and I am pretty sure this is what introduced the crashes.