Bug 249452

Summary: REGRESSION(257681@main) [WebDriver] Invalid WebPageProxy references after RefPtr moved into callbacks
Product: WebKit Reporter: Lauro Moura <lmoura>
Component: WebDriverAssignee: Lauro Moura <lmoura>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, cgarcia, ddkilzer, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=248912

Description Lauro Moura 2022-12-15 23:05:26 PST
257681@main replaced plain WebPageProxy pointers with RefPtr, but IIUC, it also WTFMove'd some of these RefPtr into lambda captures while they were still used outside leading to invalid references. For example, being passed into a WebProcessProxy& parameter in the exitFullscreenWindowForPage() call inside setWindowFrameOfBrowsingContext() in [1]. When exit... executed, the page parameter received was (nil) after being moved.

As this happened in some WebAutomationSession methods used during the setup of many tests, the failures in the webdriver suite increased from ~23 to ~2008.

First build with failure: https://build.webkit.org/#/builders/37/builds/13372

Patch incoming.

[1] https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp#L417
Comment 1 Lauro Moura 2022-12-15 23:43:01 PST
Pull request: https://github.com/WebKit/WebKit/pull/7737
Comment 2 EWS 2022-12-16 07:42:49 PST
Committed 257988@main (7301504e0c22): <https://commits.webkit.org/257988@main>

Reviewed commits have been landed. Closing PR #7737 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-12-16 07:43:17 PST
<rdar://problem/103447051>