- Revision
- 271190
- Author
- [email protected]
- Date
- 2021-01-05 19:27:09 -0800 (Tue, 05 Jan 2021)
Log Message
REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad
https://bugs.webkit.org/show_bug.cgi?id=220065
<rdar://problem/71932792>
Reviewed by Darin Adler.
Source/WebKit:
r261157 changed how WebKit determined the user interface idiom for
WKWebViews that were created in daemons. Since daemons do not create
UIApplications, WebKit cannot use UIDevice in these instances. Instead,
the user interface idiom determination logic was updated to include
a check for device hardware, using MobileGestalt, in cases where no
UIApplication was created.
Since WebKit only determines the user interface idiom once (then
storing the obtained value), the added determination logic breaks
down for iPhone apps on iPad. Consider the following sequence of
events, eventually leading to a crash when interacting with a
<select> element:
1. A WKWebView is created prior to UIApplication initialization. This
can be achieved by creating one in another class's "load" method.
2. Since the app is physically running on an iPad, WebKit determines
the user interface idiom to be "iPad" and saves this information.
3. Once the app actually launches, UIApplication is initialized.
Since this is an iPhone app on iPad, the actual user interface
idiom is "iPhone". However, WebKit does not know this, since
it uses the saved user interface idiom from (2).
4. When tapping a <select> element, WebKit checks its saved idiom,
an attempts to present a UIPopoverController (the standard behavior
under the iPad idiom).
5. However, since the actual idiom is iPhone, UIKit throws an
NSInvalidArgumentException, since UIPopoverController
should not be used when running under the iPhone idiom.
A simple fix for the crash would be to call into UIKit to check the
idiom each time it is required, rather than relying on the saved bit.
However, this does not address the more general issue, which is that
WebKit's saved idiom and the actual idiom can be out of sync.
Consequently, the approach taken is to update the saved idiom when
it changes. This should only occur when a UIApplication is initialized.
Hence, we listen for UIApplicationDidFinishLaunchingNotification,
and if the actual idiom is different from our saved idiom, we update the
saved idiom and also notify the WebProcess.
* Shared/UserInterfaceIdiom.h:
* Shared/UserInterfaceIdiom.mm:
(WebKit::updateCurrentUserInterfaceIdiom):
This method checks the actual idiom and updates the saved idiom if
they differ. Returns true only if the idiom was updated.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
Listen for UIApplicationDidFinishLaunchingNotification if the idiom
can change (UIApplication is uninitialized). Then, if the actual
and saved idiom differ, notify all WebProcesses of the change.
(WebKit::WebProcessPool::unregisterNotificationObservers):
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::userInterfaceIdiomDidChange):
Update the saved idiom using the information from the UIProcess.
Tools:
Added an API test to exercise the previously crashing, and now fixed,
codepath. Note that the test will trivially pass on iPhones, since the
crash only occurs on iPads. See below for an explanation of how the
test functions on iPads.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/UserInterfaceIdiomUpdate.mm: Added.
(TestWebKitAPI::TEST):
Since TestWebKitAPI is not an application, [UIApplication sharedApplication]
is nil when the test creates a WKWebView. Consequently, when the WKWebView
is created, WebKit uses the device hardware information to determine the user
interface idiom (iPad). Now, before the test interacts with the WKWebView,
the user interface idiom is changed to an iPhone and the UIApplication is
initialized. Note that the UIApplicationDidFinishLaunchingNotification
is manually posted, since there is no UIApplicationDelegate.
Without the changes in this patch, the test will crash, since the user
interface idiom maintained by WebKit would not be updated, and would
remain iPad rather than iPhone. Hence, when focusing a select element, the test
would attempt to present a UIPopoverController. However, since the idiom
is actually iPhone, UIKit will throw an NSInvalidArgumentException.
After the changes in this patch, the test does crash, as the change to the
user interface idiom after UIApplication creation is recognized by WebKit,
and the attempt to present a UIPopoverController under the iPhone idiom
does not occur.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (271189 => 271190)
--- trunk/Source/WebKit/ChangeLog 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/ChangeLog 2021-01-06 03:27:09 UTC (rev 271190)
@@ -1,3 +1,77 @@
+2021-01-05 Aditya Keerthi <[email protected]>
+
+ REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad
+ https://bugs.webkit.org/show_bug.cgi?id=220065
+ <rdar://problem/71932792>
+
+ Reviewed by Darin Adler.
+
+ r261157 changed how WebKit determined the user interface idiom for
+ WKWebViews that were created in daemons. Since daemons do not create
+ UIApplications, WebKit cannot use UIDevice in these instances. Instead,
+ the user interface idiom determination logic was updated to include
+ a check for device hardware, using MobileGestalt, in cases where no
+ UIApplication was created.
+
+ Since WebKit only determines the user interface idiom once (then
+ storing the obtained value), the added determination logic breaks
+ down for iPhone apps on iPad. Consider the following sequence of
+ events, eventually leading to a crash when interacting with a
+ <select> element:
+
+ 1. A WKWebView is created prior to UIApplication initialization. This
+ can be achieved by creating one in another class's "load" method.
+
+ 2. Since the app is physically running on an iPad, WebKit determines
+ the user interface idiom to be "iPad" and saves this information.
+
+ 3. Once the app actually launches, UIApplication is initialized.
+ Since this is an iPhone app on iPad, the actual user interface
+ idiom is "iPhone". However, WebKit does not know this, since
+ it uses the saved user interface idiom from (2).
+
+ 4. When tapping a <select> element, WebKit checks its saved idiom,
+ an attempts to present a UIPopoverController (the standard behavior
+ under the iPad idiom).
+
+ 5. However, since the actual idiom is iPhone, UIKit throws an
+ NSInvalidArgumentException, since UIPopoverController
+ should not be used when running under the iPhone idiom.
+
+ A simple fix for the crash would be to call into UIKit to check the
+ idiom each time it is required, rather than relying on the saved bit.
+ However, this does not address the more general issue, which is that
+ WebKit's saved idiom and the actual idiom can be out of sync.
+
+ Consequently, the approach taken is to update the saved idiom when
+ it changes. This should only occur when a UIApplication is initialized.
+ Hence, we listen for UIApplicationDidFinishLaunchingNotification,
+ and if the actual idiom is different from our saved idiom, we update the
+ saved idiom and also notify the WebProcess.
+
+ * Shared/UserInterfaceIdiom.h:
+ * Shared/UserInterfaceIdiom.mm:
+ (WebKit::updateCurrentUserInterfaceIdiom):
+
+ This method checks the actual idiom and updates the saved idiom if
+ they differ. Returns true only if the idiom was updated.
+
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::registerNotificationObservers):
+
+ Listen for UIApplicationDidFinishLaunchingNotification if the idiom
+ can change (UIApplication is uninitialized). Then, if the actual
+ and saved idiom differ, notify all WebProcesses of the change.
+
+ (WebKit::WebProcessPool::unregisterNotificationObservers):
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::userInterfaceIdiomDidChange):
+
+ Update the saved idiom using the information from the UIProcess.
+
2021-01-05 Chris Dumez <[email protected]>
[iOS] Add a feature flag to stop leaking an XPC boost message to XPC services
Modified: trunk/Source/WebKit/Shared/UserInterfaceIdiom.h (271189 => 271190)
--- trunk/Source/WebKit/Shared/UserInterfaceIdiom.h 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/Shared/UserInterfaceIdiom.h 2021-01-06 03:27:09 UTC (rev 271190)
@@ -31,6 +31,7 @@
bool currentUserInterfaceIdiomIsPadOrMac();
void setCurrentUserInterfaceIdiomIsPadOrMac(bool);
+bool updateCurrentUserInterfaceIdiom();
}
Modified: trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm (271189 => 271190)
--- trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2021-01-06 03:27:09 UTC (rev 271190)
@@ -79,6 +79,16 @@
userInterfaceIdiomIsPadState = isPad ? UserInterfaceIdiomState::IsPad : UserInterfaceIdiomState::IsNotPad;
}
+bool updateCurrentUserInterfaceIdiom()
+{
+ bool isPad = userInterfaceIdiomIsPad();
+ if (currentUserInterfaceIdiomIsPadOrMac() == isPad)
+ return false;
+
+ setCurrentUserInterfaceIdiomIsPadOrMac(isPad);
+ return true;
}
+}
+
#endif
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (271189 => 271190)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-01-06 03:27:09 UTC (rev 271190)
@@ -680,6 +680,14 @@
startObservingPreferenceChanges();
}];
#endif
+ if (![UIApplication sharedApplication]) {
+ m_applicationLaunchObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) {
+ if (WebKit::updateCurrentUserInterfaceIdiom()) {
+ auto isPadOrMac = WebKit::currentUserInterfaceIdiomIsPadOrMac();
+ sendToAllProcesses(Messages::WebProcess::UserInterfaceIdiomDidChange(isPadOrMac));
+ }
+ }];
+ }
#endif
m_powerSourceNotifier = WTF::makeUnique<WebCore::PowerSourceNotifier>([this] (bool hasAC) {
@@ -711,6 +719,7 @@
#if PLATFORM(IOS_FAMILY)
[[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
+ [[NSNotificationCenter defaultCenter] removeObserver:m_applicationLaunchObserver.get()];
#endif
[[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (271189 => 271190)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-01-06 03:27:09 UTC (rev 271190)
@@ -659,6 +659,7 @@
std::unique_ptr<WebCore::PowerSourceNotifier> m_powerSourceNotifier;
RetainPtr<NSObject> m_activationObserver;
RetainPtr<NSObject> m_accessibilityEnabledObserver;
+ RetainPtr<NSObject> m_applicationLaunchObserver;
#endif
bool m_processTerminationEnabled { true };
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (271189 => 271190)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-01-06 03:27:09 UTC (rev 271190)
@@ -536,6 +536,8 @@
#endif
#if PLATFORM(IOS_FAMILY)
+ void userInterfaceIdiomDidChange(bool);
+
bool shouldFreezeOnSuspension() const;
void updateFreezerStatus();
#endif
Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (271189 => 271190)
--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-01-06 03:27:09 UTC (rev 271190)
@@ -120,6 +120,10 @@
DisplayConfigurationChanged(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags)
#endif
+#if PLATFORM(IOS_FAMILY)
+ UserInterfaceIdiomDidChange(bool isPadOrMac)
+#endif
+
#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
BacklightLevelDidChange(float backlightLevel)
#endif
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (271189 => 271190)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-01-06 03:27:09 UTC (rev 271190)
@@ -902,6 +902,11 @@
UIAccessibilityPostNotification(kAXPidStatusChangedNotification, @{ @"pid" : @(getpid()), @"suspended" : @(suspended) });
}
+void WebProcess::userInterfaceIdiomDidChange(bool isPadOrMac)
+{
+ WebKit::setCurrentUserInterfaceIdiomIsPadOrMac(isPadOrMac);
+}
+
bool WebProcess::shouldFreezeOnSuspension() const
{
switch (m_processType) {
Modified: trunk/Tools/ChangeLog (271189 => 271190)
--- trunk/Tools/ChangeLog 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Tools/ChangeLog 2021-01-06 03:27:09 UTC (rev 271190)
@@ -1,3 +1,39 @@
+2021-01-05 Aditya Keerthi <[email protected]>
+
+ REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad
+ https://bugs.webkit.org/show_bug.cgi?id=220065
+ <rdar://problem/71932792>
+
+ Reviewed by Darin Adler.
+
+ Added an API test to exercise the previously crashing, and now fixed,
+ codepath. Note that the test will trivially pass on iPhones, since the
+ crash only occurs on iPads. See below for an explanation of how the
+ test functions on iPads.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/ios/UserInterfaceIdiomUpdate.mm: Added.
+ (TestWebKitAPI::TEST):
+
+ Since TestWebKitAPI is not an application, [UIApplication sharedApplication]
+ is nil when the test creates a WKWebView. Consequently, when the WKWebView
+ is created, WebKit uses the device hardware information to determine the user
+ interface idiom (iPad). Now, before the test interacts with the WKWebView,
+ the user interface idiom is changed to an iPhone and the UIApplication is
+ initialized. Note that the UIApplicationDidFinishLaunchingNotification
+ is manually posted, since there is no UIApplicationDelegate.
+
+ Without the changes in this patch, the test will crash, since the user
+ interface idiom maintained by WebKit would not be updated, and would
+ remain iPad rather than iPhone. Hence, when focusing a select element, the test
+ would attempt to present a UIPopoverController. However, since the idiom
+ is actually iPhone, UIKit will throw an NSInvalidArgumentException.
+
+ After the changes in this patch, the test does crash, as the change to the
+ user interface idiom after UIApplication creation is recognized by WebKit,
+ and the attempt to present a UIPopoverController under the iPhone idiom
+ does not occur.
+
2021-01-05 Jonathan Bedard <[email protected]>
[webkitscmpy] Add command to canonicalize unpushed commits
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (271189 => 271190)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-01-06 03:24:49 UTC (rev 271189)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-01-06 03:27:09 UTC (rev 271190)
@@ -1103,6 +1103,7 @@
E3F8AB92241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */; };
E5036F78211BC25400BFDBE2 /* color-drop.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E5036F77211BC22800BFDBE2 /* color-drop.html */; };
E589183C252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E589183B252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm */; };
+ E5AA42F2259128AE00410A3D /* UserInterfaceIdiomUpdate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */; };
E5AA8D1D25151CC60051CC45 /* DateInputTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */; };
EB230D40245E727900C66AD1 /* IDBCheckpointWAL.mm in Sources */ = {isa = PBXBuildFile; fileRef = EB230D3E245E726300C66AD1 /* IDBCheckpointWAL.mm */; };
EB230D41245E813F00C66AD1 /* IDBCheckpointWAL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = EB230D3D245E722E00C66AD1 /* IDBCheckpointWAL.html */; };
@@ -2847,6 +2848,7 @@
E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
E5036F77211BC22800BFDBE2 /* color-drop.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "color-drop.html"; sourceTree = "<group>"; };
E589183B252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DateTimeInputsAccessoryViewTests.mm; sourceTree = "<group>"; };
+ E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UserInterfaceIdiomUpdate.mm; sourceTree = "<group>"; };
E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DateInputTests.mm; sourceTree = "<group>"; };
EB230D3D245E722E00C66AD1 /* IDBCheckpointWAL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IDBCheckpointWAL.html; sourceTree = "<group>"; };
EB230D3E245E726300C66AD1 /* IDBCheckpointWAL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IDBCheckpointWAL.mm; sourceTree = "<group>"; };
@@ -3663,6 +3665,7 @@
F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */,
F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */,
F402F56B23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm */,
+ E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */,
F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */,
514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */,
1CACADA0230620AD0007D54C /* WKWebViewOpaque.mm */,
@@ -5559,6 +5562,7 @@
7CCE7F2D1A411B1000447C4C /* UserContentTest.mm in Sources */,
7C882E0A1C80C764006BF731 /* UserContentWorld.mm in Sources */,
7CCB99211D3B41F6003922F6 /* UserInitiatedActionInNavigationAction.mm in Sources */,
+ E5AA42F2259128AE00410A3D /* UserInterfaceIdiomUpdate.mm in Sources */,
7CCE7F171A411AE600447C4C /* UserMedia.cpp in Sources */,
0799C3491EBA2D7B003B7532 /* UserMediaDisabled.mm in Sources */,
07F4E92E20AF59E2002E3803 /* UserMediaSimulateFailedSandbox.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/ios/UserInterfaceIdiomUpdate.mm (0 => 271190)
--- trunk/Tools/TestWebKitAPI/Tests/ios/UserInterfaceIdiomUpdate.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/UserInterfaceIdiomUpdate.mm 2021-01-06 03:27:09 UTC (rev 271190)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+#import "TestInputDelegate.h"
+#import "TestWKWebView.h"
+#import "UIKitSPI.h"
+#import "UserInterfaceSwizzler.h"
+#import <WebKit/WKWebViewPrivate.h>
+
+namespace TestWebKitAPI {
+
+TEST(UserInterfaceIdiomUpdate, SelectPopoverCrash)
+{
+ auto inputDelegate = adoptNS([TestInputDelegate new]);
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+ [webView _setInputDelegate:inputDelegate.get()];
+ [webView synchronouslyLoadHTMLString:@"<select id='select'><option selected>foo</option><option>bar</option></select>"];
+ [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy {
+ return _WKFocusStartsInputSessionPolicyAllow;
+ }];
+
+ IPhoneUserInterfaceSwizzler iPhoneUserInterface;
+ [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidFinishLaunchingNotification object:nil userInfo:nil];
+
+ [webView stringByEvaluatingJavaScript:@"select.focus()"];
+}
+
+} // namespace TestWebKitAPI
+
+#endif // PLATFORM(IOS_FAMILY)