WebKit Bugzilla
Attachment 360832 Details for
Bug 194140
: [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
bug-194140-20190131221634.patch (text/plain), 29.07 KB, created by
Wenson Hsieh
on 2019-01-31 22:16:35 PST
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-31 22:16:35 PST
Size:
29.07 KB
patch
obsolete
>Subversion Revision: 240715 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 11d679ebbcab423c02e3f231904033eabe96c9a0..31e5facedf51dc65c7b1eccd0203c78824d05081 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,38 @@ >+2019-01-31 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events >+ https://bugs.webkit.org/show_bug.cgi?id=194140 >+ <rdar://problem/47728098> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: fast/events/touch/ios/show-modal-alert-during-touch-start.html >+ >+ * Shared/ios/InteractionInformationRequest.cpp: >+ (WebKit::InteractionInformationRequest::isValidForRequest): >+ * Shared/ios/InteractionInformationRequest.h: >+ * UIProcess/API/C/WKContextConfigurationRef.cpp: >+ (WKContextConfigurationIgnoreSynchronousMessagingTimeoutsForTesting): >+ (WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting): >+ * UIProcess/API/C/WKContextConfigurationRef.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView ensurePositionInformationIsUpToDate:]): >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): >+ (WebKit::WebChromeClient::runJavaScriptAlert): >+ (WebKit::WebChromeClient::runJavaScriptConfirm): >+ (WebKit::WebChromeClient::runJavaScriptPrompt): >+ (WebKit::WebChromeClient::print): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::cancelPendingSynchronousReplies): >+ (WebKit::WebPage::touchEventSync): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::getPositionInformation): >+ (WebKit::WebPage::positionInformation): >+ (WebKit::WebPage::requestPositionInformation): >+ > 2019-01-30 Simon Fraser <simon.fraser@apple.com> > > Add some basic geometry information to the scrolling tree >diff --git a/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp b/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >index 5fcfc03d012be8bc0e0e18b97a25d1287f226502..7fe286f4529b9e70ee093383e8571476922c54e9 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >+++ b/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >@@ -56,6 +56,9 @@ bool InteractionInformationRequest::decode(IPC::Decoder& decoder, InteractionInf > > bool InteractionInformationRequest::isValidForRequest(const InteractionInformationRequest& other) > { >+ if (!isValid) >+ return false; >+ > if (other.point != point) > return false; > >diff --git a/Source/WebKit/Shared/ios/InteractionInformationRequest.h b/Source/WebKit/Shared/ios/InteractionInformationRequest.h >index d274babec7a103fcc8e6c9d1922479fc03f85790..409bfec74a788a62be0442c94cf25ecbe64505dd 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationRequest.h >+++ b/Source/WebKit/Shared/ios/InteractionInformationRequest.h >@@ -39,6 +39,7 @@ namespace WebKit { > struct InteractionInformationRequest { > WebCore::IntPoint point; > >+ bool isValid { true }; > bool includeSnapshot { false }; > bool includeLinkIndicator { false }; > >diff --git a/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp b/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp >index 86d41299dfaab3d64e7c41e060c02f661cd1c37e..338c0ddd7696c32d5d5c0ae1da865bf325c1b37e 100644 >--- a/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp >@@ -138,6 +138,16 @@ void WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(WKContextC > toImpl(configuration)->setFullySynchronousModeIsAllowedForTesting(allowed); > } > >+bool WKContextConfigurationIgnoreSynchronousMessagingTimeoutsForTesting(WKContextConfigurationRef configuration) >+{ >+ return toImpl(configuration)->ignoreSynchronousMessagingTimeoutsForTesting(); >+} >+ >+void WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting(WKContextConfigurationRef configuration, bool ignore) >+{ >+ toImpl(configuration)->setIgnoreSynchronousMessagingTimeoutsForTesting(ignore); >+} >+ > WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration) > { > return toAPI(&API::Array::createStringArray(toImpl(configuration)->overrideLanguages()).leakRef()); >diff --git a/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h b/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h >index 32694172c5784d9380a3d4ca06924a5f1fd4efaa..ad3e7a172f80354eca982403a49fa885142fe575 100644 >--- a/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h >+++ b/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h >@@ -63,6 +63,9 @@ WK_EXPORT void WKContextConfigurationSetResourceLoadStatisticsDirectory(WKContex > WK_EXPORT bool WKContextConfigurationFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration); > WK_EXPORT void WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration, bool allowed); > >+WK_EXPORT bool WKContextConfigurationIgnoreSynchronousMessagingTimeoutsForTesting(WKContextConfigurationRef configuration); >+WK_EXPORT void WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting(WKContextConfigurationRef configuration, bool ignore); >+ > WK_EXPORT WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration); > WK_EXPORT void WKContextConfigurationSetOverrideLanguages(WKContextConfigurationRef configuration, WKArrayRef overrideLanguages); > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 16b06dc8abf34a130dfbb173a2a57f8df9f4508b..460268001a795ef0b3c27b670104e81636b5a04c 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1716,7 +1716,8 @@ - (BOOL)ensurePositionInformationIsUpToDate:(WebKit::InteractionInformationReque > if ([self _hasValidOutstandingPositionInformationRequest:request]) > return connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidReceivePositionInformation>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); > >- _hasValidPositionInformation = _page->process().sendSync(Messages::WebPage::GetPositionInformation(request), Messages::WebPage::GetPositionInformation::Reply(_positionInformation), _page->pageID(), 1_s); >+ bool receivedMessage = _page->process().sendSync(Messages::WebPage::GetPositionInformation(request), Messages::WebPage::GetPositionInformation::Reply(_positionInformation), _page->pageID(), 1_s); >+ _hasValidPositionInformation = receivedMessage && _positionInformation.request.isValidForRequest(request); > > // FIXME: We need to clean up these handlers in the event that we are not able to collect data, or if the WebProcess crashes. > if (_hasValidPositionInformation) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 6c8245fcdf8287ef7c57885be886c77d810a81c9..e6be34ba3b15c1b54dbfa795c9ac5d7814c7d7c9 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -405,6 +405,7 @@ bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame& > > HangDetectionDisabler hangDetectionDisabler; > >+ m_page.cancelPendingSynchronousReplies(); > if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) > return false; > >@@ -451,6 +452,7 @@ void WebChromeClient::runJavaScriptAlert(Frame& frame, const String& alertText) > > HangDetectionDisabler hangDetectionDisabler; > >+ m_page.cancelPendingSynchronousReplies(); > WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend); > } > >@@ -467,6 +469,7 @@ bool WebChromeClient::runJavaScriptConfirm(Frame& frame, const String& message) > > HangDetectionDisabler hangDetectionDisabler; > >+ m_page.cancelPendingSynchronousReplies(); > bool result = false; > if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) > return false; >@@ -487,6 +490,7 @@ bool WebChromeClient::runJavaScriptPrompt(Frame& frame, const String& message, c > > HangDetectionDisabler hangDetectionDisabler; > >+ m_page.cancelPendingSynchronousReplies(); > if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) > return false; > >@@ -714,6 +718,7 @@ void WebChromeClient::print(Frame& frame) > } > #endif > >+ m_page.cancelPendingSynchronousReplies(); > m_page.sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend); > } > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 23a9780a8afe98180bf3703f65cc4e03f3319bff..78d26f825d123f4d25368544c8157e9ffdbc4703 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -42,6 +42,8 @@ > #include "InjectUserScriptImmediately.h" > #include "InjectedBundle.h" > #include "InjectedBundleScriptWorld.h" >+#include "InteractionInformationAtPosition.h" >+#include "InteractionInformationRequest.h" > #include "LibWebRTCProvider.h" > #include "LoadParameters.h" > #include "Logging.h" >@@ -2723,6 +2725,24 @@ void WebPage::requestFontAttributesAtSelectionStart(CallbackID callbackID) > send(Messages::WebPageProxy::FontAttributesCallback(attributes, callbackID)); > } > >+void WebPage::cancelPendingSynchronousReplies() >+{ >+#if ENABLE(IOS_TOUCH_EVENTS) >+ if (auto reply = WTFMove(m_pendingSynchronousTouchEventReply)) >+ reply(true); >+#endif >+ >+#if PLATFORM(IOS_FAMILY) >+ if (auto reply = WTFMove(m_pendingSynchronousPositionInformationReply)) { >+ InteractionInformationAtPosition response; >+ InteractionInformationRequest request; >+ request.isValid = false; >+ response.request = WTFMove(request); >+ reply(WTFMove(response)); >+ } >+#endif >+} >+ > #if ENABLE(TOUCH_EVENTS) > static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page) > { >@@ -2744,13 +2764,19 @@ void WebPage::dispatchTouchEvent(const WebTouchEvent& touchEvent, bool& handled) > updatePotentialTapSecurityOrigin(touchEvent, handled); > } > >-void WebPage::touchEventSync(const WebTouchEvent& touchEvent, bool& handled) >+void WebPage::touchEventSync(const WebTouchEvent& touchEvent, CompletionHandler<void(bool)>&& reply) > { >+ m_pendingSynchronousTouchEventReply = WTFMove(reply); >+ > EventDispatcher::TouchEventQueue queuedEvents; > WebProcess::singleton().eventDispatcher().getQueuedTouchEventsForPage(*this, queuedEvents); > dispatchAsynchronousTouchEvents(queuedEvents); > >+ bool handled = true; > dispatchTouchEvent(touchEvent, handled); >+ >+ if (auto reply = WTFMove(m_pendingSynchronousTouchEventReply)) >+ reply(handled); > } > > void WebPage::updatePotentialTapSecurityOrigin(const WebTouchEvent& touchEvent, bool wasHandled) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 1be5906c95d518d3651b9a76c326b100d2f76115..b9f63a1fee202110cfea829bfc381c8c945f6ecb 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -596,6 +596,8 @@ public: > void viewportPropertiesDidChange(const WebCore::ViewportArguments&); > void executeEditCommandWithCallback(const String&, const String& argument, CallbackID); > >+ void cancelPendingSynchronousReplies(); >+ > #if PLATFORM(IOS_FAMILY) > WebCore::FloatSize screenSize() const; > WebCore::FloatSize availableScreenSize() const; >@@ -647,7 +649,7 @@ public: > void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied); > void requestAutocorrectionContext(CallbackID); > void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length); >- void getPositionInformation(const InteractionInformationRequest&, InteractionInformationAtPosition&); >+ void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&); > void requestPositionInformation(const InteractionInformationRequest&); > void startInteractionWithElementAtPosition(const WebCore::IntPoint&); > void stopInteraction(); >@@ -1178,6 +1180,8 @@ private: > void resetTextAutosizing(); > WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement); > RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement); >+ >+ InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&); > #endif > > #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION) >@@ -1234,7 +1238,7 @@ private: > void keyEvent(const WebKeyboardEvent&); > > #if ENABLE(IOS_TOUCH_EVENTS) >- void touchEventSync(const WebTouchEvent&, bool& handled); >+ void touchEventSync(const WebTouchEvent&, CompletionHandler<void(bool)>&&); > void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled); > #elif ENABLE(TOUCH_EVENTS) > void touchEvent(const WebTouchEvent&); >@@ -1695,6 +1699,10 @@ private: > RefPtr<WebCore::Element> m_focusedElement; > bool m_hasPendingBlurNotification { false }; > bool m_hasPendingEditorStateUpdate { false }; >+ >+#if ENABLE(IOS_TOUCH_EVENTS) >+ CompletionHandler<void(bool)> m_pendingSynchronousTouchEventReply; >+#endif > > #if PLATFORM(IOS_FAMILY) > RefPtr<WebCore::Range> m_currentWordRange; >@@ -1740,6 +1748,8 @@ private: > Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID; > double m_lastTransactionPageScaleFactor { 0 }; > uint64_t m_lastTransactionIDWithScaleChange { 0 }; >+ >+ CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply; > #endif > > WebCore::Timer m_layerVolatilityTimer; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 47e9ce6ba7c6992b1d8796b27e0dc898a702f7e8..414f0182429a87c1d209679d26a8f909bf42541a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -80,7 +80,7 @@ messages -> WebPage LegacyReceiver { > SyncApplyAutocorrection(String correction, String originalText) -> (bool autocorrectionApplied) LegacySync > RequestAutocorrectionContext(WebKit::CallbackID callbackID) > GetAutocorrectionContext() -> (String beforeContext, String markedText, String selectedText, String afterContext, uint64_t location, uint64_t length) LegacySync >- GetPositionInformation(struct WebKit::InteractionInformationRequest request) -> (struct WebKit::InteractionInformationAtPosition information) LegacySync >+ GetPositionInformation(struct WebKit::InteractionInformationRequest request) -> (struct WebKit::InteractionInformationAtPosition information) Delayed > RequestPositionInformation(struct WebKit::InteractionInformationRequest request) > StartInteractionWithElementAtPosition(WebCore::IntPoint point) > StopInteraction() >@@ -121,7 +121,7 @@ messages -> WebPage LegacyReceiver { > #endif > > #if ENABLE(IOS_TOUCH_EVENTS) >- TouchEventSync(WebKit::WebTouchEvent event) -> (bool handled) LegacySync >+ TouchEventSync(WebKit::WebTouchEvent event) -> (bool handled) Delayed > #endif > #if !ENABLE(IOS_TOUCH_EVENTS) && ENABLE(TOUCH_EVENTS) > TouchEvent(WebKit::WebTouchEvent event) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index d894467266bb50bf50575bedcbdddd672638e9f2..5d1b1dd90697cf80c4819a2a3e6964041b8eb825 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2085,8 +2085,19 @@ static inline bool isAssistableElement(Element& node) > return node.isContentEditable(); > } > >-void WebPage::getPositionInformation(const InteractionInformationRequest& request, InteractionInformationAtPosition& info) >+void WebPage::getPositionInformation(const InteractionInformationRequest& request, CompletionHandler<void(InteractionInformationAtPosition&&)>&& reply) > { >+ m_pendingSynchronousPositionInformationReply = WTFMove(reply); >+ >+ auto information = positionInformation(request); >+ >+ if (auto reply = WTFMove(m_pendingSynchronousPositionInformationReply)) >+ reply(WTFMove(information)); >+} >+ >+InteractionInformationAtPosition WebPage::positionInformation(const InteractionInformationRequest& request) >+{ >+ InteractionInformationAtPosition info; > info.request = request; > > FloatPoint adjustedPoint; >@@ -2262,14 +2273,13 @@ void WebPage::getPositionInformation(const InteractionInformationRequest& reques > info.hasSelectionAtPosition = m_page->hasSelectionAtPosition(adjustedPoint); > #endif > info.adjustedPointForNodeRespondingToClickEvents = adjustedPoint; >+ >+ return info; > } > > void WebPage::requestPositionInformation(const InteractionInformationRequest& request) > { >- InteractionInformationAtPosition info; >- >- getPositionInformation(request, info); >- send(Messages::WebPageProxy::DidReceivePositionInformation(info)); >+ send(Messages::WebPageProxy::DidReceivePositionInformation(positionInformation(request))); > } > > void WebPage::startInteractionWithElementAtPosition(const WebCore::IntPoint& point) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 9b48791eb108c0b3fb78af7d052d7b6618f23b98..9ef96f030309b28e53ac472824b2662340bc9b73 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2019-01-31 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events >+ https://bugs.webkit.org/show_bug.cgi?id=194140 >+ <rdar://problem/47728098> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::runJavaScriptAlert): >+ (WTR::TestController::createOtherPage): >+ (WTR::TestController::generateContextConfiguration const): >+ (WTR::TestController::createWebViewWithOptions): >+ (WTR::updateTestOptionsFromTestHeader): >+ (WTR::TestController::handleJavaScriptAlert): >+ * WebKitTestRunner/TestController.h: >+ * WebKitTestRunner/TestOptions.h: >+ (WTR::TestOptions::hasSameInitializationOptions const): >+ > 2019-01-30 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r240708. >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 92e160a615890d336924c560f433ab0ed255a944..02577c85c82973c06a55a828134574ea2e1c08ac 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -239,6 +239,11 @@ static void decidePolicyForUserMediaPermissionRequest(WKPageRef, WKFrameRef fram > TestController::singleton().handleUserMediaPermissionRequest(frame, userMediaDocumentOrigin, topLevelDocumentOrigin, permissionRequest); > } > >+static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo) >+{ >+ TestController::singleton().handleJavaScriptAlert(listener); >+} >+ > static void checkUserMediaPermissionForOrigin(WKPageRef, WKFrameRef frame, WKSecurityOriginRef userMediaDocumentOrigin, WKSecurityOriginRef topLevelDocumentOrigin, WKUserMediaPermissionCheckRef checkRequest, const void*) > { > TestController::singleton().handleCheckOfUserMediaPermissionForOrigin(frame, userMediaDocumentOrigin, topLevelDocumentOrigin, checkRequest); >@@ -326,7 +331,7 @@ WKPageRef TestController::createOtherPage(PlatformWebView* parentView, WKPageCon > 0, // runJavaScriptPrompt > 0, // mediaSessionMetadataDidChange > createOtherPage, >- 0, // runJavaScriptAlert >+ runJavaScriptAlert, > 0, // runJavaScriptConfirm > 0, // runJavaScriptPrompt > checkUserMediaPermissionForOrigin, >@@ -442,11 +447,12 @@ void TestController::initialize(int argc, const char* argv[]) > m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get())); > } > >-WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration() const >+WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration(const TestOptions& options) const > { > auto configuration = adoptWK(WKContextConfigurationCreate()); > WKContextConfigurationSetInjectedBundlePath(configuration.get(), injectedBundlePath()); > WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(configuration.get(), true); >+ WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting(configuration.get(), options.ignoreSynchronousMessagingTimeoutsForTesting); > > if (const char* dumpRenderTreeTemp = libraryPathForTesting()) { > String temporaryFolder = String::fromUTF8(dumpRenderTreeTemp); >@@ -534,7 +540,7 @@ WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(WK > > void TestController::createWebViewWithOptions(const TestOptions& options) > { >- auto contextConfiguration = generateContextConfiguration(); >+ auto contextConfiguration = generateContextConfiguration(options); > > WKRetainPtr<WKMutableArrayRef> overrideLanguages = adoptWK(WKMutableArrayCreate()); > for (auto& language : options.overrideLanguages) >@@ -614,7 +620,7 @@ void TestController::createWebViewWithOptions(const TestOptions& options) > 0, // runJavaScriptPrompt > 0, // mediaSessionMetadataDidChange > createOtherPage, >- 0, // runJavaScriptAlert >+ runJavaScriptAlert, > 0, // runJavaScriptConfirm > 0, // runJavaScriptPrompt > checkUserMediaPermissionForOrigin, >@@ -1273,6 +1279,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std: > testOptions.enableUndoManagerAPI = parseBooleanTestHeaderValue(value); > else if (key == "contentInset.top") > testOptions.contentInsetTop = std::stod(value); >+ else if (key == "ignoreSynchronousMessagingTimeoutsForTesting") >+ testOptions.ignoreSynchronousMessagingTimeoutsForTesting = parseBooleanTestHeaderValue(value); > pairStart = pairEnd + 1; > } > } >@@ -2325,6 +2333,15 @@ void TestController::resetUserMediaPermission() > m_isUserMediaPermissionSet = false; > } > >+void TestController::handleJavaScriptAlert(WKPageRunJavaScriptAlertResultListenerRef listener) >+{ >+ WKRetain(listener); >+ callOnMainThread([listener] { >+ WKPageRunJavaScriptAlertResultListenerCall(listener); >+ WKRelease(listener); >+ }); >+} >+ > class OriginSettings : public RefCounted<OriginSettings> { > public: > explicit OriginSettings() >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index 25ec904be42b2cdc3094e1ebeab3d7f97d4a95e2..7fa8600e4235ba0863d835a2836fee85b8126729 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -284,9 +284,11 @@ public: > bool canDoServerTrustEvaluationInNetworkProcess() const; > uint64_t serverTrustEvaluationCallbackCallsCount() const { return m_serverTrustEvaluationCallbackCallsCount; } > >+ void handleJavaScriptAlert(WKPageRunJavaScriptAlertResultListenerRef); >+ > private: > WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); >- WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration() const; >+ WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration(const TestOptions&) const; > void initialize(int argc, const char* argv[]); > void createWebViewWithOptions(const TestOptions&); > void run(); >diff --git a/Tools/WebKitTestRunner/TestOptions.h b/Tools/WebKitTestRunner/TestOptions.h >index 614ce7b5818597ea9a4813adc7b2e1fc46a46079..f91dd50c9d206b03d3f380b75a81d09523eefcbc 100644 >--- a/Tools/WebKitTestRunner/TestOptions.h >+++ b/Tools/WebKitTestRunner/TestOptions.h >@@ -68,6 +68,7 @@ struct TestOptions { > bool enableEditableImages { false }; > bool editable { false }; > bool enableUndoManagerAPI { false }; >+ bool ignoreSynchronousMessagingTimeoutsForTesting { false }; > > double contentInsetTop { 0 }; > >@@ -116,7 +117,8 @@ struct TestOptions { > || enableEditableImages != options.enableEditableImages > || editable != options.editable > || enableUndoManagerAPI != options.enableUndoManagerAPI >- || contentInsetTop != options.contentInsetTop) >+ || contentInsetTop != options.contentInsetTop >+ || ignoreSynchronousMessagingTimeoutsForTesting != options.ignoreSynchronousMessagingTimeoutsForTesting) > return false; > > if (experimentalFeatures != options.experimentalFeatures) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 89a857cc3fc1ea6defa62e5f08d8f3620a2e68df..a7990401ffe040f2b9657ed758fac6395e11b82b 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-31 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events >+ https://bugs.webkit.org/show_bug.cgi?id=194140 >+ <rdar://problem/47728098> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/events/touch/ios/show-modal-alert-during-touch-start-expected.txt: Added. >+ * fast/events/touch/ios/show-modal-alert-during-touch-start.html: Added. >+ > 2019-01-30 Simon Fraser <simon.fraser@apple.com> > > Add some basic geometry information to the scrolling tree >diff --git a/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start-expected.txt b/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..681709ac00093e0375d6bea8df64d69697799f8c >--- /dev/null >+++ b/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start-expected.txt >@@ -0,0 +1,3 @@ >+ALERT: This is a modal alert. >+Tap to show an alert >+This test verifies that presenting a modal alert while handling a synchronous touch event doesn't cause the application process to hang. To verify manually, tap the red area above, and check that the JavaScript alert is presented with no significant delay. >diff --git a/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start.html b/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start.html >new file mode 100644 >index 0000000000000000000000000000000000000000..282bbdd7b37a8c6da0cdbf3e07396fff53bd46fc >--- /dev/null >+++ b/LayoutTests/fast/events/touch/ios/show-modal-alert-during-touch-start.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, ignoreSynchronousMessagingTimeoutsForTesting=true ] --> >+<html> >+<head> >+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> >+<script src="../../../../resources/ui-helper.js"></script> >+<style> >+body, html { >+ width: 100%; >+ height: 100%; >+ margin: 0; >+} >+ >+#target { >+ background-color: tomato; >+ color: white; >+ width: 100%; >+ height: 200px; >+ text-align: center; >+ font-size: 20px; >+} >+</style> >+</head> >+<body> >+<div id="target">Tap to show an alert</div> >+<p>This test verifies that presenting a modal alert while handling a synchronous touch event doesn't cause the application process to hang. To verify manually, tap the red area above, and check that the JavaScript alert is presented with no significant delay.</p> >+<script> >+if (window.testRunner) { >+ testRunner.waitUntilDone(); >+ testRunner.dumpAsText(); >+} >+ >+target.addEventListener("touchstart", () => alert("This is a modal alert.")); >+target.addEventListener("touchend", () => testRunner.notifyDone()); >+addEventListener("load", async () => await UIHelper.activateAt(100, 100)); >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194140
:
360832
|
360843
|
360871
|
360884
|
360892