Title: [238380] trunk/Tools
- Revision
- 238380
- Author
- wenson_hs...@apple.com
- Date
- 2018-11-19 13:37:00 -0800 (Mon, 19 Nov 2018)
Log 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:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (238379 => 238380)
--- trunk/Tools/ChangeLog 2018-11-19 21:22:51 UTC (rev 238379)
+++ trunk/Tools/ChangeLog 2018-11-19 21:37:00 UTC (rev 238380)
@@ -1,3 +1,25 @@
+2018-11-19 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [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:
+
2018-11-19 Fujii Hironori <hironori.fu...@sony.com>
REGRESSION(r238016)[GTK][TestWebKitAPI][Ninja] TestJSC can't compile "Bytecodes.h: No such file or directory"
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (238379 => 238380)
--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2018-11-19 21:22:51 UTC (rev 238379)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2018-11-19 21:37:00 UTC (rev 238380)
@@ -28,6 +28,7 @@
#if WK_API_ENABLED
+#import "ClassMethodSwizzler.h"
#import "TestNavigationDelegate.h"
#import "Utilities.h"
@@ -185,6 +186,9 @@
@implementation TestWKWebView {
RetainPtr<TestWKWebViewHostWindow> _hostWindow;
RetainPtr<TestMessageHandler> _testHandler;
+#if PLATFORM(IOS_FAMILY)
+ std::unique_ptr<TestWebKitAPI::ClassMethodSwizzler> _sharedCalloutBarSwizzler;
+#endif
}
- (instancetype)initWithFrame:(CGRect)frame
@@ -198,6 +202,15 @@
return [self initWithFrame:frame configuration:configuration addToWindow:YES];
}
+#if PLATFORM(IOS_FAMILY)
+
+static UICalloutBar *suppressUICalloutBar()
+{
+ return nil;
+}
+
+#endif
+
- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration addToWindow:(BOOL)addToWindow
{
self = [super initWithFrame:frame configuration:configuration];
@@ -207,6 +220,11 @@
if (addToWindow)
[self _setUpTestWindow:frame];
+#if PLATFORM(IOS_FAMILY)
+ // FIXME: Remove this workaround once <https://webkit.org/b/175204> is fixed.
+ _sharedCalloutBarSwizzler = std::make_unique<TestWebKitAPI::ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar));
+#endif
+
return self;
}
Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (238379 => 238380)
--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2018-11-19 21:22:51 UTC (rev 238379)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2018-11-19 21:37:00 UTC (rev 238380)
@@ -30,6 +30,7 @@
#if USE(APPLE_INTERNAL_SDK)
#import <UIKit/UIApplication_Private.h>
+#import <UIKit/UICalloutBar.h>
#import <UIKit/UIKeyboard_Private.h>
#import <UIKit/UIResponder_Private.h>
#import <UIKit/UITextInputMultiDocument.h>
@@ -97,6 +98,10 @@
- (NSDictionary *)_autofillContext;
@end
+@interface UICalloutBar : UIView
++ (UICalloutBar *)sharedCalloutBar;
+@end
+
#if ENABLE(DRAG_SUPPORT)
@protocol UIDragInteractionDelegate_Proposed_SPI_33146803 <UIDragInteractionDelegate>
- (void)_dragInteraction:(UIDragInteraction *)interaction itemsForAddingToSession:(id <UIDragSession>)session withTouchAtPoint:(CGPoint)point completion:(void(^)(NSArray<UIDragItem *> *))completion;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes