Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e46278c3187befc399b1c4ff4004e60d9d45c38c
https://github.com/WebKit/WebKit/commit/e46278c3187befc399b1c4ff4004e60d9d45c38c
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2025-03-12 (Wed, 12 Mar 2025)
Changed paths:
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
Log Message:
-----------
[UnifiedPDF] [iOS Debug] Web content process crashes immediately when a PDF
document is loaded
https://bugs.webkit.org/show_bug.cgi?id=289588
rdar://146814007
Reviewed by Tim Horton.
Currently, in debug configurations, loading a PDF document crashes the
WCP immediately with this backtrace:
```
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 WebKit 0x11bec9df4
WTFCrashWithInfo(int, char const*, char const*, int) + 100
1 WebKit 0x11ede484c
WebKit::PDFDocumentLayout::nearestPageIndexForDocumentPoint(WebCore::FloatPoint,
std::__1::optional<WebKit::PDFLayoutRow> const&) const + 152
2 WebKit 0x11edeaa58
WebKit::PDFPresentationController::nearestPageIndexForDocumentPoint(WebCore::FloatPoint
const&) const + 168
3 WebKit 0x11ee547bc
WebKit::UnifiedPDFPlugin::updatePageNumberIndicatorCurrentPage(std::__1::optional<WebCore::IntRect>
const&) + 260
4 WebKit 0x11ee40300
WebKit::UnifiedPDFPlugin::updatePageNumberIndicator(std::__1::optional<WebCore::IntRect>
const&) + 56
5 WebKit 0x11ee46770
WebKit::UnifiedPDFPlugin::visibilityDidChange(bool) + 68
6 WebKit 0x11fe28c84
WebKit::PluginView::viewVisibilityDidChange() + 156
7 WebKit 0x11fe28778
WebKit::PluginView::initializePlugin() + 188
8 WebKit 0x11fe29a8c
WebKit::PluginView::setParent(WebCore::ScrollView*) + 60
9 WebCore 0x306262460
WebCore::ScrollView::addChild(WebCore::Widget&) + 300
10 WebCore 0x305f17354
WebCore::LocalFrameView::addChild(WebCore::Widget&) + 148
11 WebCore 0x306ffe388
WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets() + 472
12 WebCore 0x30214f160
WebCore::WidgetHierarchyUpdatesSuspensionScope::~WidgetHierarchyUpdatesSuspensionScope()
+ 196
13 WebCore 0x30213ca94
WebCore::WidgetHierarchyUpdatesSuspensionScope::~WidgetHierarchyUpdatesSuspensionScope()
+ 32
14 WebCore 0x305f0dd20
WebCore::LocalFrameView::updateEmbeddedObjects() + 368
15 WebCore 0x305ef6b68
WebCore::LocalFrameView::updateEmbeddedObjectsTimerFired() + 68
16 WebCore 0x305f0dfe0
WebCore::LocalFrameView::flushAnyPendingPostLayoutTasks() + 64
```
We're unconditionally calling into updatePageNumberIndicatorCurrentPage()
during plugin initialization. However, this is wrong because the plugin
document is not fully installed yet, and so we don't have valid document
data or a complete page count.
We fix this bug by gating the rest of the page number indicator update
cycle behind the outcome of updatePageNumberIndicatorVisibility().
Specifically, the indicator's page count and location should only be
updated if we requested the UI process to make the indicator visible to
begin with.
No additional tests required. Without this patch, PDF API tests are all
crashy on debug iOS anyway, and we progress that significantly here.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updatePageNumberIndicatorVisibility):
(WebKit::UnifiedPDFPlugin::updatePageNumberIndicator):
Canonical link: https://commits.webkit.org/292012@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes