Bug 207121

Summary: Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, achristensen, adachan, ap, beidson, cgarcia, clopez, commit-queue, ggaren, rniwa, webkit-bot-watchers-bugzilla, 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=207189
Bug Depends on:    
Bug Blocks: 204950    
Attachments:
Description Flags
Patch none

Description Chris Dumez 2020-02-03 08:58:42 PST
WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView, in case we time out while waiting for an answer from the WebProcess but the WebProcess eventually responds.
Comment 1 Chris Dumez 2020-02-03 08:58:56 PST
<rdar://problem/58880177>
Comment 2 Chris Dumez 2020-02-03 09:00:48 PST
Created attachment 389521 [details]
Patch
Comment 3 WebKit Commit Bot 2020-02-03 14:21:58 PST
Comment on attachment 389521 [details]
Patch

Clearing flags on attachment: 389521

Committed r255595: <https://trac.webkit.org/changeset/255595>
Comment 4 WebKit Commit Bot 2020-02-03 14:22:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Aakash Jain 2020-02-03 17:59:02 PST
> Committed r255595: <https://trac.webkit.org/changeset/255595>
This seems to have broken api-gtk test: /WebKit2Gtk/TestUIClient:/webkit/WebKitWebView/javascript-dialogs

Can you please check?
Comment 6 Carlos Garcia Campos 2020-02-04 01:23:26 PST
Comment on attachment 389521 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389521&action=review

> Source/WebKit/UIProcess/WebPageProxy.cpp:1134
> +        // If we timed out, don't ask the client to close again.
> +        if (!m_tryCloseTimeoutTimer.isActive())
> +            return;

This is assuming that the timer being not active means we timed out, but WebPageProxy::runBeforeUnloadConfirmPanel() stops the timer.