Regression(AsyncPolicyDelegates): Box.app login Window is blank
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2018 22:41:06 +0000 (22:41 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2018 22:41:06 +0000 (22:41 +0000)
commit10683f5f67b592cdfba66b373a1fc6acee44635a
treeb77508a727f2e8c2c8fc47815d0883e75792e77e
parent6057df00c79419e696b23fd14a89f2bbad1746c1
Regression(AsyncPolicyDelegates): Box.app login Window is blank
https://bugs.webkit.org/show_bug.cgi?id=185832
<rdar://problem/40307871>

Reviewed by Geoffrey Garen.

Source/WebKit:

Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
WebKitLegacy code.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
* UIProcess/API/Cocoa/WKConnection.mm:
* UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
* UIProcess/API/Cocoa/WKProcessGroup.mm:
* UIProcess/API/Cocoa/WKProcessPool.mm:
* UIProcess/API/Cocoa/WKScriptMessage.mm:
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
* UIProcess/API/Cocoa/_WKAutomationSession.mm:
* UIProcess/API/Cocoa/_WKDownload.mm:
* UIProcess/API/Cocoa/_WKElementAction.mm:
* UIProcess/ApplicationStateTracker.h:
* UIProcess/Cocoa/AutomationClient.h:
* UIProcess/Cocoa/AutomationSessionClient.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.h:
* UIProcess/Cocoa/DownloadClient.h:
* UIProcess/Cocoa/FindClient.h:
* UIProcess/Cocoa/FullscreenClient.h:
* UIProcess/Cocoa/IconLoadingDelegate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
* UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/ios/ViewGestureControllerIOS.mm:
* UIProcess/ios/WKActionSheetAssistant.mm:
* UIProcess/ios/WKContentViewInteraction.mm:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_setContentProviderData:suggestedFilename:]):
* UIProcess/ios/WKScrollView.mm:
* UIProcess/mac/WKInspectorViewController.mm:
* UIProcess/mac/WKInspectorWKWebView.mm:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

Source/WebKitLegacy/mac:

We used to have a bug where where we would fail to wait for the policy decision for
the navigation response from the client and the load would keep going, racing with
the client's policy decision. If the client did not respond in time, the behavior
would be the same as "Use" policy action.

Box.app fails to make any policy decision in its decidePolicyForMIMEType delegate
but the load happened to proceed anyway due to our bug. Now that we've fixed the
WebKit bug, however, the load would hang because the completion handler for the
decidePolicyForNavigationResponse would never get called.

To work around the issue, I made the policy listener weak on the WebFrameLoaderClient
instead of retaining it. If the policy listener object gets destroyed because getting
resolved, we now use "Use" policy action in its dealloc function to maintain previous
behavior.

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::cancelPolicyCheck):
(WebFrameLoaderClient::setUpPolicyListener):
(-[WebFramePolicyListener dealloc]):

Source/WTF:

Moved WeakObjCPtr.h from WebKit2 to WTF with RetainPtr.h, so that it can be used
in WebKitLegacy code.

* WTF.xcodeproj/project.pbxproj:
* wtf/WeakObjCPtr.h: Renamed from Source/WebKit/Shared/mac/WeakObjCPtr.h.

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/cocoa/WeakObjCPtr.mm:
* TestWebKitAPI/Tests/mac/NoPolicyDelegateResponse.mm: Added.
(-[NoPolicyDelegateDecisionDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
(-[NoPolicyDelegateDecisionDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
(-[NoPolicyDelegateDecisionDelegate webView:didFinishLoadForFrame:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView _isBackground]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
48 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/WeakObjCPtr.h [moved from Source/WebKit/Shared/mac/WeakObjCPtr.h with 94% similarity]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h
Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm
Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKScriptMessage.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSession.mm
Source/WebKit/UIProcess/API/Cocoa/_WKDownload.mm
Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm
Source/WebKit/UIProcess/ApplicationStateTracker.h
Source/WebKit/UIProcess/Cocoa/AutomationClient.h
Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h
Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h
Source/WebKit/UIProcess/Cocoa/DownloadClient.h
Source/WebKit/UIProcess/Cocoa/FindClient.h
Source/WebKit/UIProcess/Cocoa/FullscreenClient.h
Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
Source/WebKit/UIProcess/Cocoa/UIDelegate.h
Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
Source/WebKit/UIProcess/ios/WKApplicationStateTrackingView.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm
Source/WebKit/UIProcess/ios/WKPDFView.mm
Source/WebKit/UIProcess/ios/WKScrollView.mm
Source/WebKit/UIProcess/mac/WKInspectorViewController.mm
Source/WebKit/UIProcess/mac/WKInspectorWKWebView.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit/cocoa/WeakObjCPtr.mm
Tools/TestWebKitAPI/Tests/mac/NoPolicyDelegateResponse.mm [new file with mode: 0644]