Changeset 229177 in webkit
- Timestamp:
- Mar 2, 2018 9:41:07 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r229171 r229177 1 2018-03-02 Chris Dumez <cdumez@apple.com> 2 3 Converting a load to a download does not work with async policy delegates 4 https://bugs.webkit.org/show_bug.cgi?id=183254 5 <rdar://problem/38035334> 6 7 Reviewed by Youenn Fablet. 8 9 Add layout test coverage. 10 11 * fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate-expected.txt: Added. 12 * fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html: Added. 13 1 14 2018-03-02 Claudio Saavedra <csaavedra@igalia.com> 2 15 -
trunk/LayoutTests/platform/ios-wk1/TestExpectations
r228587 r229177 1335 1335 # testRunner.setShouldDownloadUndisplayableMIMETypes() is not supported on WK1. 1336 1336 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Skip ] 1337 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ] 1337 1338 1338 1339 webkit.org/b/137572 scrollbars/scrollbar-iframe-click-does-not-blur-content.html [ Failure ] -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r228984 r229177 1130 1130 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-download.html [ Skip ] 1131 1131 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Skip ] 1132 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ] 1132 1133 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ] 1133 1134 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ] -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r229086 r229177 304 304 # testRunner.setShouldDownloadUndisplayableMIMETypes() is not supported on WK1. 305 305 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Skip ] 306 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ] 306 307 307 308 webkit.org/b/156629 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html [ Pass Failure ] -
trunk/LayoutTests/platform/win/TestExpectations
r229147 r229177 442 442 # testRunner.setShouldDownloadUndisplayableMIMETypes() is not supported on WK1. 443 443 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Skip ] 444 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ] 444 445 445 446 # TODO Expose title direction in WebKit API (Chromium Only) -
trunk/Source/WebCore/ChangeLog
r229176 r229177 1 2018-03-02 Chris Dumez <cdumez@apple.com> 2 3 Converting a load to a download does not work with async policy delegates 4 https://bugs.webkit.org/show_bug.cgi?id=183254 5 <rdar://problem/38035334> 6 7 Reviewed by Youenn Fablet. 8 9 Update DocumentLoader::responseReceived() to call didReceiveResponsePolicy() 10 on the mainResourceLoader *after* calling continueAfterContentPolicy(), 11 not *before*. This makes sure that the WebResourceLoader sends the 12 NetworkResourceLoader::ContinueDidReceiveResponse IPC back to the Network 13 Process *after* the policy decision has been processed, which restores the 14 pre-r228852 order. 15 16 Test: fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html 17 18 * loader/DocumentLoader.cpp: 19 (WebCore::DocumentLoader::responseReceived): 20 1 21 2018-03-02 Youenn Fablet <youenn@apple.com> 2 22 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r229086 r229177 784 784 #endif 785 785 786 if (auto* mainResourceLoader = this->mainResourceLoader()) 786 RefPtr<SubresourceLoader> mainResourceLoader = this->mainResourceLoader(); 787 if (mainResourceLoader) 787 788 mainResourceLoader->markInAsyncResponsePolicyCheck(); 788 frameLoader()->checkContentPolicy(m_response, [this, protectedThis = makeRef(*this)](PolicyAction policy) { 789 if (auto* mainResourceLoader = this->mainResourceLoader()) 789 frameLoader()->checkContentPolicy(m_response, [this, protectedThis = makeRef(*this), mainResourceLoader = WTFMove(mainResourceLoader)](PolicyAction policy) { 790 continueAfterContentPolicy(policy); 791 if (mainResourceLoader) 790 792 mainResourceLoader->didReceiveResponsePolicy(); 791 792 continueAfterContentPolicy(policy);793 793 }); 794 794 } -
trunk/Tools/ChangeLog
r229150 r229177 1 2018-03-02 Chris Dumez <cdumez@apple.com> 2 3 Converting a load to a download does not work with async policy delegates 4 https://bugs.webkit.org/show_bug.cgi?id=183254 5 <rdar://problem/38035334> 6 7 Reviewed by Youenn Fablet. 8 9 Add layout test infrastructure for responding to the decidePolicyForNavigationResponse 10 delegate asynchronously. 11 12 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 13 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 14 (WTR::InjectedBundlePage::decidePolicyForResponse): 15 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 16 (WTR::TestRunner::setShouldDecideResponsePolicyAfterDelay): 17 * WebKitTestRunner/InjectedBundle/TestRunner.h: 18 (WTR::TestRunner::shouldDecideResponsePolicyAfterDelay const): 19 * WebKitTestRunner/TestController.cpp: 20 (WTR::TestController::resetStateToConsistentValues): 21 (WTR::TestController::decidePolicyForNavigationResponse): 22 * WebKitTestRunner/TestController.h: 23 (WTR::TestController::setShouldDecideResponsePolicyAfterDelay): 24 * WebKitTestRunner/TestInvocation.cpp: 25 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): 26 1 27 2018-03-01 Youenn Fablet <youenn@apple.com> 2 28 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r229106 r229177 91 91 void setPrinting(); 92 92 void setShouldDecideNavigationPolicyAfterDelay(boolean value); 93 void setShouldDecideResponsePolicyAfterDelay(boolean value); 93 94 void setNavigationGesturesEnabled(boolean value); 94 95 void setIgnoresViewportScaleLimits(boolean value); -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r228984 r229177 1368 1368 WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef page, WKBundleFrameRef, WKURLResponseRef response, WKURLRequestRef, WKTypeRef*) 1369 1369 { 1370 if (InjectedBundle::singleton().testRunner()->isPolicyDelegateEnabled() && WKURLResponseIsAttachment(response)) { 1370 auto& injectedBundle = InjectedBundle::singleton(); 1371 if (injectedBundle.testRunner()->isPolicyDelegateEnabled() && WKURLResponseIsAttachment(response)) { 1371 1372 StringBuilder stringBuilder; 1372 1373 WKRetainPtr<WKStringRef> filename = adoptWK(WKURLResponseCopySuggestedFilename(response)); … … 1376 1377 InjectedBundle::singleton().outputText(stringBuilder.toString()); 1377 1378 } 1379 1380 if (injectedBundle.testRunner()->shouldDecideResponsePolicyAfterDelay()) 1381 return WKBundlePagePolicyActionPassThrough; 1378 1382 1379 1383 WKRetainPtr<WKStringRef> mimeType = adoptWK(WKURLResponseCopyMIMEType(response)); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r229106 r229177 1112 1112 } 1113 1113 1114 void TestRunner::setShouldDecideResponsePolicyAfterDelay(bool value) 1115 { 1116 m_shouldDecideResponsePolicyAfterDelay = value; 1117 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldDecideResponsePolicyAfterDelay")); 1118 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 1119 WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get()); 1120 } 1121 1114 1122 void TestRunner::setNavigationGesturesEnabled(bool value) 1115 1123 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r229106 r229177 330 330 bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; } 331 331 void setShouldDecideNavigationPolicyAfterDelay(bool); 332 bool shouldDecideResponsePolicyAfterDelay() const { return m_shouldDecideResponsePolicyAfterDelay; } 333 void setShouldDecideResponsePolicyAfterDelay(bool); 332 334 void setNavigationGesturesEnabled(bool); 333 335 void setIgnoresViewportScaleLimits(bool); … … 476 478 477 479 bool m_shouldDecideNavigationPolicyAfterDelay { false }; 480 bool m_shouldDecideResponsePolicyAfterDelay { false }; 478 481 bool m_shouldFinishAfterDownload { false }; 479 482 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r229106 r229177 855 855 856 856 m_shouldDecideNavigationPolicyAfterDelay = false; 857 m_shouldDecideResponsePolicyAfterDelay = false; 857 858 858 859 setNavigationGesturesEnabled(false); … … 2229 2230 void TestController::decidePolicyForNavigationResponse(WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener) 2230 2231 { 2231 // Even though Response was already checked by WKBundlePagePolicyClient, the check did not include plugins 2232 // so we have to re-check again. 2233 if (WKNavigationResponseCanShowMIMEType(navigationResponse)) { 2234 WKFramePolicyListenerUse(listener); 2235 return; 2236 } 2237 2238 if (m_shouldDownloadUndisplayableMIMETypes) 2239 WKFramePolicyListenerDownload(listener); 2232 WKRetainPtr<WKNavigationResponseRef> retainedNavigationResponse { navigationResponse }; 2233 WKRetainPtr<WKFramePolicyListenerRef> retainedListener { listener }; 2234 2235 bool shouldDownloadUndisplayableMIMETypes = m_shouldDownloadUndisplayableMIMETypes; 2236 auto decisionFunction = [shouldDownloadUndisplayableMIMETypes, retainedNavigationResponse, retainedListener]() { 2237 // Even though Response was already checked by WKBundlePagePolicyClient, the check did not include plugins 2238 // so we have to re-check again. 2239 if (WKNavigationResponseCanShowMIMEType(retainedNavigationResponse.get())) { 2240 WKFramePolicyListenerUse(retainedListener.get()); 2241 return; 2242 } 2243 2244 if (shouldDownloadUndisplayableMIMETypes) 2245 WKFramePolicyListenerDownload(retainedListener.get()); 2246 else 2247 WKFramePolicyListenerIgnore(retainedListener.get()); 2248 }; 2249 2250 if (m_shouldDecideResponsePolicyAfterDelay) 2251 RunLoop::main().dispatch(WTFMove(decisionFunction)); 2240 2252 else 2241 WKFramePolicyListenerIgnore(listener);2253 decisionFunction(); 2242 2254 } 2243 2255 -
trunk/Tools/WebKitTestRunner/TestController.h
r229106 r229177 149 149 150 150 void setShouldDecideNavigationPolicyAfterDelay(bool value) { m_shouldDecideNavigationPolicyAfterDelay = value; } 151 void setShouldDecideResponsePolicyAfterDelay(bool value) { m_shouldDecideResponsePolicyAfterDelay = value; } 151 152 152 153 void setNavigationGesturesEnabled(bool value); … … 416 417 417 418 bool m_shouldDecideNavigationPolicyAfterDelay { false }; 419 bool m_shouldDecideResponsePolicyAfterDelay { false }; 418 420 419 421 WKRetainPtr<WKArrayRef> m_openPanelFileURLs; -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r229106 r229177 706 706 } 707 707 708 if (WKStringIsEqualToUTF8CString(messageName, "SetShouldDecideResponsePolicyAfterDelay")) { 709 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 710 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 711 TestController::singleton().setShouldDecideResponsePolicyAfterDelay(WKBooleanGetValue(value)); 712 return; 713 } 714 708 715 if (WKStringIsEqualToUTF8CString(messageName, "SetNavigationGesturesEnabled")) { 709 716 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
Note: See TracChangeset
for help on using the changeset viewer.