Page crashes when opening a context menu for an image if the image is a broken link or while it's loading.
As Andrew says here we could have a struct to pass more information to the context menu, to have more control of what to show in the context menu.
auto immutable_bitmap = image_element.immutable_bitmap();
bool valid = immutable_bitmap.ptr() && image_element.complete();
auto bitmap = valid ? immutable_bitmap->bitmap() : nullptr;
Page::ImageContextMenu menu {
.valid = valid,
.image_url = image_element.document().parse_url(image_element.src()),
.bitmap = bitmap,
};
maybe we should have more options?
macOS
Open context menu, or at least don't crash the page.
Page crashes.
N/A
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Broken Image</title>
</head>
<body>
<img src="https://ladybird.org/assets/img/logo-new.webp">
<img src="invalid.webp" style="width: 200px; height: 200px;">
</body>
</html>
VERIFICATION FAILED: m_ptr at /Users/fmmazur/Projects/contrib/ladybird/AK/RefPtr.h:280
0 liblagom-ak.0.0.0.dylib 0x0000000103c84e3c ak_trap + 56
1 liblagom-ak.0.0.0.dylib 0x0000000103c85140 ak_assertion_failed + 0
2 liblagom-web.0.0.0.dylib 0x00000001058c8a44 Web::EventHandler::handle_mouseup(Gfx::Point<Web::CSSPixels>, Gfx::Point<Web::CSSPixels>, unsigned int, unsigned int, unsigned int) + 2528
3 WebContent 0x0000000102e6b1f8 WebContent::ConnectionFromClient::process_next_input_event() + 404
4 liblagom-web.0.0.0.dylib 0x00000001059146dc AK::Function<void ()>::CallableWrapper<Web::Platform::TimerSerenity::TimerSerenity()::$_0>::call() + 96
5 liblagom-core.0.0.0.dylib 0x00000001038dd404 Core::Timer::timer_event(Core::TimerEvent&) + 208
6 liblagom-core.0.0.0.dylib 0x00000001038c9340 Core::EventReceiver::dispatch_event(Core::Event&, Core::EventReceiver*) + 228
7 liblagom-core.0.0.0.dylib 0x00000001038dc138 Core::ThreadEventQueue::process() + 424
8 liblagom-core.0.0.0.dylib 0x00000001038de7bc Core::EventLoopImplementationUnix::exec() + 44
9 liblagom-core.0.0.0.dylib 0x00000001038c6eac Core::EventLoop::exec() + 72
10 WebContent 0x0000000102e66b68 serenity_main(Main::Arguments) + 6868
11 WebContent 0x0000000102f35960 main + 192
12 dyld 0x000000019c5f7154 start + 2476
No response
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too