Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d995884fd85bb07b7c1be713ec235bd1491b312a
https://github.com/WebKit/WebKit/commit/d995884fd85bb07b7c1be713ec235bd1491b312a
Author: Yury Semikhatsky <[email protected]>
Date: 2026-09-08 (Tue, 08 Sep 2026)
Changed paths:
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm
M Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm
A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PopupMenuTests.mm
Log Message:
-----------
NEW TEST(319401@main): [macOS Debug]
TestWebKitAPI.ContextMenuTests.MenuTrackingCancelledWhenPageCloses is flaky
https://bugs.webkit.org/show_bug.cgi?id=323373
Reviewed by Devin Rousso.
WebPageProxy::close() dismissed the active context menu with -[NSMenu
cancelTracking],
which fades the menu out inside AppKit's nested tracking run loop. The fade
lasts about
240 ms, and the test polled that run loop every 250 ms to detect a menu that
stayed open,
so on slow Debug bots the poll occasionally fired once more before tracking
ended and
the test wrongly reported the menu as still open. Closing the page also sent
DidDismissContextMenu to a WebPage that had already been closed, which the web
process
logged as an unhandled message.
Dismiss the menu with -[NSMenu cancelTrackingWithoutAnimation] instead, since
there is
nothing to animate for a page that is going away, and only send
DidDismissContextMenu
when the page still has a running process.
Popup menus for <select> elements run the same kind of nested tracking loop and
are
cancelled from close() the same way, so dismiss them without animation too. Add
a
counterpart test that opens a popup menu and closes the page while it is
tracking.
Make the context menu test stop polling once it has closed the page and instead
arm a
one-shot watchdog timer in the tracking run loop mode. The watchdog can only
fire if the
menu is still tracking two seconds after the page closed, in which case it
records the
failure and dismisses the menu itself so the test fails instead of hanging. The
new popup
menu test uses the same approach.
Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PopupMenuTests.mm
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didDismissContextMenu):
* Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::cancelTracking):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm:
(TestWebKitAPI::TEST(ContextMenuTests, MenuTrackingCancelledWhenPageCloses)):
* Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::cancelTracking):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PopupMenuTests.mm: Added.
(TestWebKitAPI::TEST(PopupMenuTests, MenuTrackingCancelledWhenPageCloses)):
Canonical link: https://commits.webkit.org/320686@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications