Changeset 251847 in webkit


Ignore:
Timestamp:
Oct 31, 2019 8:23:10 AM (4 years ago)
Author:
Wenson Hsieh
Message:

Add telemetry to test a potential cause of crashes under -[WKContentView _interpretKeyEvent:isCharEvent:]
https://bugs.webkit.org/show_bug.cgi?id=203630
<rdar://problem/56769229>

Reviewed by Simon Fraser.

This iOS-specific crash occurs under -_interpretKeyEvent:isCharEvent:, when we first try to access WebEvent's
properties with event.keyboardFlags. This suggests that between storing the WebEvent in WebPageProxy's
m_keyEventQueue, and later receiving an InterpretKeyEvent sync IPC message in the UI process, something ends up
overreleasing (or otherwise writing over or corrupting) the WebEvent.

However, from code inspection, nothing appears to overrelease the WebEvent; an alternate possibility is that the
API is somehow being invoked from a background thread, which would explain why the WebEvent may sometimes get
destroyed too early.

To try and detect this scenario (and avoid keeping any strong references to WebEvent at all), add an
os_log_fault in case the API is being called on a background thread, and bail immediately.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView handleKeyWebEvent:withCompletionHandler:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r251837 r251847  
     12019-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add telemetry to test a potential cause of crashes under -[WKContentView _interpretKeyEvent:isCharEvent:]
     4        https://bugs.webkit.org/show_bug.cgi?id=203630
     5        <rdar://problem/56769229>
     6
     7        Reviewed by Simon Fraser.
     8
     9        This iOS-specific crash occurs under `-_interpretKeyEvent:isCharEvent:`, when we first try to access WebEvent's
     10        properties with `event.keyboardFlags`. This suggests that between storing the WebEvent in WebPageProxy's
     11        m_keyEventQueue, and later receiving an InterpretKeyEvent sync IPC message in the UI process, something ends up
     12        overreleasing (or otherwise writing over or corrupting) the WebEvent.
     13
     14        However, from code inspection, nothing appears to overrelease the WebEvent; an alternate possibility is that the
     15        API is somehow being invoked from a background thread, which would explain why the WebEvent may sometimes get
     16        destroyed too early.
     17
     18        To try and detect this scenario (and avoid keeping any strong references to WebEvent at all), add an
     19        `os_log_fault` in case the API is being called on a background thread, and bail immediately.
     20
     21        * UIProcess/ios/WKContentViewInteraction.mm:
     22        (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
     23
    1242019-10-31  Miguel Gomez  <magomez@igalia.com>
    225
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r251778 r251847  
    49484948- (void)handleKeyWebEvent:(::WebEvent *)theEvent withCompletionHandler:(void (^)(::WebEvent *theEvent, BOOL wasHandled))completionHandler
    49494949{
     4950    if (!isUIThread()) {
     4951        RELEASE_LOG_FAULT(KeyHandling, "%s was invoked on a background thread.", __PRETTY_FUNCTION__);
     4952        completionHandler(theEvent, NO);
     4953        return;
     4954    }
     4955
    49504956    [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    49514957
Note: See TracChangeset for help on using the changeset viewer.