Changeset 238380 in webkit


Ignore:
Timestamp:
Nov 19, 2018 1:37:00 PM (5 years ago)
Author:
Wenson Hsieh
Message:

[iOS Debug] Assertion failure in NSComparisonResult UIContentSizeCategoryCompareToCategory()
https://bugs.webkit.org/show_bug.cgi?id=190401
<rdar://problem/45195285>

Reviewed by Dean Jackson.

Work around sporadic UIKit assertions when running API tests that may present a UICalloutBar. Currently, UIKit
asks for the UIApp’s -preferredContentSizeCategory when showing or laying out the callout bar. However,
TestWebKitAPI lacks a UIApp altogether, and forcing one to be initialized via UIApplicationInstantiateSingleton
causes numerous other UIKit and WebKit assertions to be hit.

In lieu of TestWebKitAPI becoming a real UI application (see https://webkit.org/b/175204), simply don't allow
the callout bar to be initialized in TestWKWebView-based API tests. This encompasses all API tests which
have some chance of causing the callout bar to be shown by making a ranged text selections during the test.

  • TestWebKitAPI/cocoa/TestWKWebView.mm:

(suppressUICalloutBar):
(-[TestWKWebView initWithFrame:configuration:addToWindow:]):

  • TestWebKitAPI/ios/UIKitSPI.h:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r238374 r238380  
     12018-11-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS Debug] Assertion failure in NSComparisonResult UIContentSizeCategoryCompareToCategory()
     4        https://bugs.webkit.org/show_bug.cgi?id=190401
     5        <rdar://problem/45195285>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Work around sporadic UIKit assertions when running API tests that may present a UICalloutBar. Currently, UIKit
     10        asks for the `UIApp`’s `-preferredContentSizeCategory` when showing or laying out the callout bar. However,
     11        TestWebKitAPI lacks a UIApp altogether, and forcing one to be initialized via `UIApplicationInstantiateSingleton`
     12        causes numerous other UIKit and WebKit assertions to be hit.
     13
     14        In lieu of TestWebKitAPI becoming a real UI application (see https://webkit.org/b/175204), simply don't allow
     15        the callout bar to be initialized in TestWKWebView-based API tests. This encompasses all API tests which
     16        have some chance of causing the callout bar to be shown by making a ranged text selections during the test.
     17
     18        * TestWebKitAPI/cocoa/TestWKWebView.mm:
     19        (suppressUICalloutBar):
     20        (-[TestWKWebView initWithFrame:configuration:addToWindow:]):
     21        * TestWebKitAPI/ios/UIKitSPI.h:
     22
    1232018-11-19  Fujii Hironori  <Hironori.Fujii@sony.com>
    224
  • trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

    r238188 r238380  
    2929#if WK_API_ENABLED
    3030
     31#import "ClassMethodSwizzler.h"
    3132#import "TestNavigationDelegate.h"
    3233#import "Utilities.h"
     
    186187    RetainPtr<TestWKWebViewHostWindow> _hostWindow;
    187188    RetainPtr<TestMessageHandler> _testHandler;
     189#if PLATFORM(IOS_FAMILY)
     190    std::unique_ptr<TestWebKitAPI::ClassMethodSwizzler> _sharedCalloutBarSwizzler;
     191#endif
    188192}
    189193
     
    198202    return [self initWithFrame:frame configuration:configuration addToWindow:YES];
    199203}
     204
     205#if PLATFORM(IOS_FAMILY)
     206
     207static UICalloutBar *suppressUICalloutBar()
     208{
     209    return nil;
     210}
     211
     212#endif
    200213
    201214- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration addToWindow:(BOOL)addToWindow
     
    207220    if (addToWindow)
    208221        [self _setUpTestWindow:frame];
     222
     223#if PLATFORM(IOS_FAMILY)
     224    // FIXME: Remove this workaround once <https://webkit.org/b/175204> is fixed.
     225    _sharedCalloutBarSwizzler = std::make_unique<TestWebKitAPI::ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar));
     226#endif
    209227
    210228    return self;
  • trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h

    r238360 r238380  
    3131
    3232#import <UIKit/UIApplication_Private.h>
     33#import <UIKit/UICalloutBar.h>
    3334#import <UIKit/UIKeyboard_Private.h>
    3435#import <UIKit/UIResponder_Private.h>
     
    9899@end
    99100
     101@interface UICalloutBar : UIView
     102+ (UICalloutBar *)sharedCalloutBar;
     103@end
     104
    100105#if ENABLE(DRAG_SUPPORT)
    101106@protocol UIDragInteractionDelegate_Proposed_SPI_33146803 <UIDragInteractionDelegate>
Note: See TracChangeset for help on using the changeset viewer.