Confirm <a download> satisfies specification criteria
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 21:10:41 +0000 (21:10 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 21:10:41 +0000 (21:10 +0000)
commit55af8af42ccfdb48fe2228d5fa06b980c96001d2
treed8a6bf4927481c879794f67c54f358f972243195
parentedd092eb494e3013713ac4b2f8017118be131e3e
Confirm <a download> satisfies specification criteria
https://bugs.webkit.org/show_bug.cgi?id=156057

Reviewed by Andy Estes.

Source/WebKit2:

* WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp:
(WKBundleNavigationActionGetHasDownloadAttribute): Added.
* WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h:
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
(WebKit::InjectedBundleNavigationAction::hasDownloadAttribute): Added.

Tools:

Revise WebKitTestRunner:
(1) Provide a download client delegate.
(2) Teach WKTR to wait to finish a test until a download finishes.
(3) Allow WKTR to notify the current TestRunner that it can finish.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage): Update to recognize a new
message "NotifyDownloadDone".
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::decidePolicyForNavigationAction): Handle 'download'
attribute case.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::waitUntilDownload): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::shouldFinishAfterDownload): Added.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions): Set up the download client.
(WTR::TestController::downloadDidStart): Added.
(WTR::TestController::decideDestinationWithSuggestedFilename): Added.
(WTR::TestController::downloadDidFinish): Added.
(WTR::TestController::downloadDidFail): Added.
(WTR::TestController::downloadDidCancel): Added.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::notifyDownloadDone): Added.
* WebKitTestRunner/TestInvocation.h:

LayoutTests:

Import <a download> tests from the Blink project.

Based on a Blink change (patch by <asanka@chromium.org>):
<https://src.chromium.org/viewvc/blink?revision=172767&view=revision>

* TestExpectations: Mark two expected failures with the new tests.
* fast/dom/HTMLAnchorElement/anchor-download-expected.txt: Updated for
expected output (blob URL currently not working).
* fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt: Ditto.
* http/tests/security/anchor-download-allow-blob-expected.txt: Added.
* http/tests/security/anchor-download-allow-blob.html: Added.
* http/tests/security/anchor-download-allow-data-expected.txt: Added.
* http/tests/security/anchor-download-allow-data.html: Added.
* http/tests/security/anchor-download-allow-sameorigin-expected.txt: Added.
* http/tests/security/anchor-download-allow-sameorigin.html: Added.
* http/tests/security/anchor-download-block-crossorigin-expected.txt: Added.
* http/tests/security/anchor-download-block-crossorigin.html: Added.
* http/tests/security/resources/attachment.php: Added.
* platform/ios-simulator-wk1/TestExpectations: Disable download tests until WK1 support
is implemented.
* platform/ios-simulator-wk2/TestExpectations: Disable download tests until
NETWORK_SESSION support exists.
* platform/mac/TestExpectations: Reactivate the HTMLAnchorElement tests.
* platform/mac-wk1/TestExpectations: Disable download tests until WK1 support
is implemented.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-expected.txt
LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt
LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-allow-blob.html [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-allow-data-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-allow-data.html [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-allow-sameorigin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-allow-sameorigin.html [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/anchor-download-block-crossorigin.html [new file with mode: 0644]
LayoutTests/http/tests/security/resources/attachment.php [new file with mode: 0644]
LayoutTests/platform/ios-simulator-wk1/TestExpectations
LayoutTests/platform/ios-simulator-wk2/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac/TestExpectations
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/TestInvocation.h