Title: [261157] trunk
- Revision
- 261157
- Author
- [email protected]
- Date
- 2020-05-05 02:03:21 -0700 (Tue, 05 May 2020)
Log Message
Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice]
https://bugs.webkit.org/show_bug.cgi?id=211397
<rdar://problem/61635403>
Reviewed by Simon Fraser.
Source/WebKit:
* Shared/UserInterfaceIdiom.mm:
(WebKit::userInterfaceIdiomIsPad):
Adjust userInterfaceIdiomIsPad so that in daemons, it consults only MobileGestalt,
which returns the actual hardware model, and does not try to use UIDevice.
UIDevice is more accurate for applications because it will report that
the device is an iPhone when called inside an iPhone app running on iPad,
but it cannot be used in daemons that do not have a UIApplication.
For the behaviors we gate on this bit, it makes sense to use iPhone
behaviors on iPad in the iPhone app jail, so we continue using
UIDevice if possible.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
Make use of the new mechanism instead of going straight to MobileGestalt,
for the aforementioned reasons.
Tools:
* TestWebKitAPI/ios/UserInterfaceSwizzler.h:
We need a UIApplication or WebKit won't look at UIDevice.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (261156 => 261157)
--- trunk/Source/WebKit/ChangeLog 2020-05-05 08:30:02 UTC (rev 261156)
+++ trunk/Source/WebKit/ChangeLog 2020-05-05 09:03:21 UTC (rev 261157)
@@ -1,3 +1,28 @@
+2020-05-05 Tim Horton <[email protected]>
+
+ Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice]
+ https://bugs.webkit.org/show_bug.cgi?id=211397
+ <rdar://problem/61635403>
+
+ Reviewed by Simon Fraser.
+
+ * Shared/UserInterfaceIdiom.mm:
+ (WebKit::userInterfaceIdiomIsPad):
+ Adjust userInterfaceIdiomIsPad so that in daemons, it consults only MobileGestalt,
+ which returns the actual hardware model, and does not try to use UIDevice.
+ UIDevice is more accurate for applications because it will report that
+ the device is an iPhone when called inside an iPhone app running on iPad,
+ but it cannot be used in daemons that do not have a UIApplication.
+
+ For the behaviors we gate on this bit, it makes sense to use iPhone
+ behaviors on iPad in the iPhone app jail, so we continue using
+ UIDevice if possible.
+
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration init]):
+ Make use of the new mechanism instead of going straight to MobileGestalt,
+ for the aforementioned reasons.
+
2020-05-04 Tim Horton <[email protected]>
Relax WKRemoteObjectRegistry signature validation for bool-equivalent types
Modified: trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm (261156 => 261157)
--- trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2020-05-05 08:30:02 UTC (rev 261156)
+++ trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2020-05-05 09:03:21 UTC (rev 261157)
@@ -28,11 +28,8 @@
#if PLATFORM(IOS_FAMILY)
-#if USE(APPLE_INTERNAL_SDK)
-#import <UIKit/UIDevice_Private.h>
-#else
-#import <UIKit/UIDevice.h>
-#endif
+#import "UIKitSPI.h"
+#import <WebCore/Device.h>
namespace WebKit {
@@ -44,9 +41,14 @@
static UserInterfaceIdiomState userInterfaceIdiomIsPadState = UserInterfaceIdiomState::Unknown;
-#if PLATFORM(IOS_FAMILY)
static inline bool userInterfaceIdiomIsPad()
{
+ // If we are in a daemon, we cannot use UIDevice. Fall back to checking the hardware itself.
+ // Since daemons don't ever run in an iPhone-app-on-iPad jail, this will be accurate in the daemon case,
+ // but is not sufficient in the application case.
+ if (![UIApplication sharedApplication])
+ return WebCore::deviceClass() == MGDeviceClassiPad;
+
// This inline function exists to thwart unreachable code
// detection on platforms where UICurrentUserInterfaceIdiomIsPad
// is defined directly to false.
@@ -56,7 +58,6 @@
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
#endif
}
-#endif
bool currentUserInterfaceIdiomIsPad()
{
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (261156 => 261157)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2020-05-05 08:30:02 UTC (rev 261156)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2020-05-05 09:03:21 UTC (rev 261157)
@@ -27,6 +27,7 @@
#import "WKWebViewConfigurationInternal.h"
#import "APIPageConfiguration.h"
+#import "UserInterfaceIdiom.h"
#import "VersionChecks.h"
#import "WKPreferences.h"
#import "WKProcessPool.h"
@@ -192,7 +193,7 @@
#if !PLATFORM(WATCHOS)
_allowsPictureInPictureMediaPlayback = YES;
#endif
- _allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
+ _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPad();
_inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
_allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback;
_mediaDataLoadsAutomatically = NO;
Modified: trunk/Tools/ChangeLog (261156 => 261157)
--- trunk/Tools/ChangeLog 2020-05-05 08:30:02 UTC (rev 261156)
+++ trunk/Tools/ChangeLog 2020-05-05 09:03:21 UTC (rev 261157)
@@ -1,3 +1,14 @@
+2020-05-05 Tim Horton <[email protected]>
+
+ Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice]
+ https://bugs.webkit.org/show_bug.cgi?id=211397
+ <rdar://problem/61635403>
+
+ Reviewed by Simon Fraser.
+
+ * TestWebKitAPI/ios/UserInterfaceSwizzler.h:
+ We need a UIApplication or WebKit won't look at UIDevice.
+
2020-05-04 Darin Adler <[email protected]>
[Mac] Remove __MAC_OS_X_VERSION_MIN_REQUIRED checks for versions older than 10.14
Modified: trunk/Tools/TestWebKitAPI/ios/UserInterfaceSwizzler.h (261156 => 261157)
--- trunk/Tools/TestWebKitAPI/ios/UserInterfaceSwizzler.h 2020-05-05 08:30:02 UTC (rev 261156)
+++ trunk/Tools/TestWebKitAPI/ios/UserInterfaceSwizzler.h 2020-05-05 09:03:21 UTC (rev 261157)
@@ -28,6 +28,7 @@
#if PLATFORM(IOS_FAMILY)
#import "InstanceMethodSwizzler.h"
+#import "UIKitSPI.h"
#import <UIKit/UIKit.h>
namespace TestWebKitAPI {
@@ -38,6 +39,10 @@
UserInterfaceSwizzler()
: InstanceMethodSwizzler { UIDevice.class, @selector(userInterfaceIdiom), reinterpret_cast<IMP>(effectiveUserInterfaceIdiom) }
{
+ if (!UIApplication.sharedApplication) {
+ UIApplicationInitialize();
+ UIApplicationInstantiateSingleton(UIApplication.class);
+ }
}
private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes