[Webkit-unassigned] [Bug 187843] -[WKContentView(WKInteraction) _restoreFocusWithToken:] crashed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 26 21:00:11 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=187843

--- Comment #7 from Wenson Hsieh <wenson_hsieh at apple.com> ---
Thanks for the information! From a quick glance, what could be happening is that we're getting an extra call to -_restoreFocusWithToken: when we don't expect to. The API (SPI?) contract for focus restoration is that each call to -_preserveFocusWithToken: should be bookended with exactly one call to -_restoreFocusWithToken:, so any mismatch here would cause us to crash in the UI process when we try and remove from _focusStateStack in this if statement:

    if (_focusStateStack.takeLast())

It probably makes sense to fail gracefully by bailing early if the focus state stack is empty here instead of merely debug asserting like we do now. That being said, the root cause is most likely beneath WebKit, in logic that's responsible for telling us to preserve or restore focus.

Regarding your comment in the other bug (181510):

> if we remove a webview when it is not on the top of navigationcontroller's viewcontrollers. when back to the 'webviewpage(had removed)', a crash will happen low frequently

Do you happen to have a test app that exercises this scenario? That would be very helpful in confirming a fix!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180727/6c917420/attachment.html>


More information about the webkit-unassigned mailing list